Skip to content

Commit

Permalink
Add lint workflow using [email protected]
Browse files Browse the repository at this point in the history
Add .jshintignore to skip slow/irrelevant linting of node_modules and
vendor js.

Add [email protected] as a top-level devDependency to guarantee it's
available for use from the shell. Upgrade grunt-contrib-jshint to use
[email protected] and pin grunt at ^1.0.3 since that's already in the
lockfile and is required by [email protected].

Update grunt config to watch/jshint the same files as standalone jshint
  • Loading branch information
rcowsill committed Jan 27, 2021
1 parent 4a4d1db commit 4b7437f
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 30 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Lint
on: [push, pull_request]

jobs:
lint:
name: Node.js
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node-version: ["14.x"]

steps:
- name: Checkout https://github.com/${{ github.repository }}@${{ github.ref }}
uses: actions/checkout@v2
with:
persist-credentials: false

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Run linter
run: npx --no-install [email protected] .
2 changes: 2 additions & 0 deletions .jshintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
app/assets/vendor/
14 changes: 11 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,31 @@

var exec = require("child_process").exec;

var JS_FILES = ["Gruntfile.js", "app/assets/js/**", "config/config.js", "app/data/**/*.js",
"app/routes/**/*.js", "server.js", "test/**/*.js"
var APP_JS_FILES = ["app/assets/js/**/*.js", "config/**/*.js", "app/data/**/*.js",
"app/routes/**/*.js", "server.js"
];

var SUPPORT_JS_FILES = ["Gruntfile.js", "artifacts/**/*.js", "test/**/*.js"];

var JS_FILES = APP_JS_FILES.concat(SUPPORT_JS_FILES);


module.exports = function(grunt) {
// Project Configuration
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
watch: {
js: {
files: JS_FILES,
files: APP_JS_FILES,
tasks: ["jshint"],
options: {
livereload: true
}
},
support: {
files: SUPPORT_JS_FILES,
tasks: ["jshint"]
},
html: {
files: ["app/views/**"],
options: {
Expand Down
140 changes: 115 additions & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,18 @@
"async": "^2.0.0-rc.4",
"cross-env": "^7.0.2",
"cypress": "^3.3.1",
"grunt": "^1.0.1",
"grunt": "^1.0.3",
"grunt-cli": "^1.2.0",
"grunt-concurrent": "^2.3.0",
"grunt-contrib-jshint": "^1.0.0",
"grunt-contrib-jshint": "^3.0.0",
"grunt-contrib-watch": "^1.0.0",
"grunt-env": "latest",
"grunt-if": "https://github.com/binarymist/grunt-if/tarball/master",
"grunt-jsbeautifier": "^0.2.12",
"grunt-mocha-test": "^0.12.7",
"grunt-npm-install": "^0.3.0",
"grunt-retire": "^0.3.12",
"jshint": "2.12.0",
"mocha": "^2.4.5",
"nodemon": "^1.19.1",
"selenium-webdriver": "^2.53.2",
Expand Down

0 comments on commit 4b7437f

Please sign in to comment.