Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
Add ESLint support
Browse files Browse the repository at this point in the history
  • Loading branch information
ilanbiala committed Oct 17, 2015
1 parent e30c3d1 commit d5cc4b7
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 2 deletions.
37 changes: 37 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
rules: {
indent: [2, 2, {"SwitchCase": 1}],
no-multi-spaces: 2,
no-underscore-dangle: 0,
no-use-before-define: [1, "nofunc"],
no-unused-expressions: 0,
no-empty-class: 0,
object-curly-spacing: [2, "always"],
quotes: [1, "single"],
space-in-parens: [2, "never"]
},
env: {
node: true
},
globals: {
angular: true,
$: true,
jQuery: true,
moment: true,
window: true,
document: true,
Modernizr: true,
__TESTING__: true,
beforeEach: true,
expect: true,
describe: true,
it: true,
element: true,
by: true,
browser: true,
inject: true,
register: true,
sinon: true,
_: false
}
}
6 changes: 5 additions & 1 deletion gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ module.exports = function (grunt) {
}
}
},
eslint: {
options: {},
target: _.union(defaultAssets.server.gruntConfig, defaultAssets.server.allJS, defaultAssets.client.js, testAssets.tests.server, testAssets.tests.client, testAssets.tests.e2e)
},
csslint: {
options: {
csslintrc: '.csslintrc'
Expand Down Expand Up @@ -270,7 +274,7 @@ module.exports = function (grunt) {
});

// Lint CSS and JavaScript files.
grunt.registerTask('lint', ['sass', 'less', 'jshint', 'csslint']);
grunt.registerTask('lint', ['sass', 'less', 'jshint', 'eslint', 'csslint']);

// Lint project files and minify them into two production files.
grunt.registerTask('build', ['env:dev', 'lint', 'ngAnnotate', 'uglify', 'cssmin']);
Expand Down
18 changes: 17 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,22 @@ gulp.task('jshint', function () {
.pipe(plugins.jshint.reporter('fail'));
});

// ESLint JS linting task
gulp.task('eslint', function () {
var assets = _.union(
defaultAssets.server.gulpConfig,
defaultAssets.server.allJS,
defaultAssets.client.js,
testAssets.tests.server,
testAssets.tests.client,
testAssets.tests.e2e
);

return gulp.src(assets)
.pipe(plugins.eslint())
.pipe(plugins.eslint.format());
});

// JS minifying task
gulp.task('uglify', function () {
var assets = _.union(
Expand Down Expand Up @@ -226,7 +242,7 @@ gulp.task('protractor', ['webdriver_update'], function () {

// Lint CSS and JavaScript files.
gulp.task('lint', function (done) {
runSequence('less', 'sass', ['csslint', 'jshint'], done);
runSequence('less', 'sass', ['csslint', 'eslint', 'jshint'], done);
});

// Lint project files and minify them into two production files.
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"grunt-contrib-uglify": "~0.9.1",
"grunt-contrib-watch": "~0.6.1",
"grunt-env": "~0.4.4",
"grunt-eslint": "~17.3.1",
"grunt-karma": "~0.11.2",
"grunt-mocha-istanbul": "^2.4.0",
"grunt-mocha-test": "~0.12.7",
Expand All @@ -89,6 +90,7 @@
"gulp-concat": "^2.6.0",
"gulp-csslint": "~0.1.5",
"gulp-cssmin": "~0.1.7",
"gulp-eslint": "~1.0.0",
"gulp-jshint": "^1.11.2",
"gulp-karma": "~0.0.4",
"gulp-less": "^3.0.3",
Expand Down

3 comments on commit d5cc4b7

@feimosi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it a good idea to keep both: jslint and eslint? It'll print many duplicate linting errors to the console. Also you haven't attached eslint to gulp watchers. And lastly, there's a great eslint-plugin-angular for linting Angular apps.
What do you think?
Cheers.

@ilanbiala
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@feimosi can you bring these concerns up in a new issue?

@feimosi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem, I've just done it: #1072

Please sign in to comment.