diff --git a/.eslintignore b/.eslintignore index 9b55da3236..e81c0d9253 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,9 @@ +**/node_modules/**/*.js + build/tasks/generate-imports.js -!lib/core/imports/index.js +build/tasks/aria-supported.js + +doc/api/* +doc/examples/jest_react/*.js + lib/core/imports/*.js -doc/api/* \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index aa62d5fe99..e772406985 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -13,12 +13,12 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-connect'); grunt.loadNpmTasks('grunt-contrib-copy'); - grunt.loadNpmTasks('grunt-eslint'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-mocha'); grunt.loadNpmTasks('grunt-parallel'); grunt.loadNpmTasks('grunt-markdownlint'); + grunt.loadNpmTasks('grunt-run'); grunt.loadTasks('build/tasks'); var langs; @@ -331,7 +331,6 @@ module.exports = function(grunt) { mocha: testConfig(grunt, { reporter: grunt.option('reporter') || 'Spec' }), - connect: { test: { options: { @@ -341,23 +340,10 @@ module.exports = function(grunt) { } } }, - eslint: { - axe: { - options: { - eslintrc: true, - reporter: grunt.option('report') ? 'checkstyle' : undefined, - reporterOutput: grunt.option('report') ? 'tmp/lint.xml' : undefined - }, - src: [ - 'lib/**/*.js', - 'test/**/*.js', - 'build/**/*.js', - 'doc/**/*.js', - '!doc/examples/jest_react/*.js', - 'Gruntfile.js', - '!build/tasks/aria-supported.js', - '!**/node_modules/**/*.js' - ] + run: { + npm_run_eslint: { + cmd: 'npm', + args: ['run', 'eslint'] } }, markdownlint: { @@ -372,10 +358,14 @@ module.exports = function(grunt) { grunt.registerTask('default', ['build']); - grunt.registerTask('build', [ + grunt.registerTask('pre-build', [ 'clean', 'generate-imports', - 'eslint', + 'run:npm_run_eslint' + ]); + + grunt.registerTask('build', [ + 'pre-build', 'validate', 'concat:commons', 'configure', @@ -393,7 +383,6 @@ module.exports = function(grunt) { 'connect', 'mocha', 'parallel', - 'eslint', 'markdownlint' ]); @@ -402,8 +391,7 @@ module.exports = function(grunt) { 'testconfig', 'fixture', 'connect', - 'parallel', - 'eslint' + 'parallel' ]); grunt.registerTask('test-fast', [ @@ -411,13 +399,11 @@ module.exports = function(grunt) { 'testconfig', 'fixture', 'connect', - 'mocha', - 'eslint' + 'mocha' ]); grunt.registerTask('translate', [ - 'clean', - 'eslint', + 'pre-build', 'validate', 'concat:commons', 'add-locale' diff --git a/package.json b/package.json index f9fc6259a9..a7d7f5718b 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,7 @@ "scripts": { "api-docs": "jsdoc --configure .jsdoc.json", "build": "grunt", + "eslint": "eslint --format stylish '{lib,test,build,doc}/**/*.js' 'Gruntfile.js'", "test": "npm run retire && tsc && grunt test", "version": "echo \"use 'npm run release' to bump axe-core version\" && exit 1", "prepublishOnly": "grunt build && grunt file-exists", @@ -89,10 +90,10 @@ "grunt-contrib-copy": "^1.0.0", "grunt-contrib-uglify": "^4.0.0", "grunt-contrib-watch": "^1.1.0", - "grunt-eslint": "^21.0.0", "grunt-markdownlint": "^2.0.0", "grunt-mocha": "1.1.0", "grunt-parallel": "^0.5.1", + "grunt-run": "^0.8.1", "html-entities": "^1.2.0", "husky": "^1.1.1", "jquery": "^3.0.0",