Skip to content

Commit 035d7e4

Browse files
committed
Merge pull request #2743 "Add ESLint".
- Adds ESLint checking to the automated tests, using most of the eslint:recommended rules in addition to some style rules. - Adds two "local" ESLint rules to match MooTools' specific whitespace and indentation styles, in Grunt/plugins/eslint/rules. - Fixes syntax inconsistencies based on ESLint results.
2 parents 882f2dd + 164391f commit 035d7e4

40 files changed

+1086
-218
lines changed

.eslintrc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
root: true
2+
3+
extends: 'eslint:recommended'
4+
5+
rules:
6+
no-cond-assign: 0
7+
no-constant-condition: 0
8+
no-empty: 0
9+
no-extra-semi: 0
10+
no-octal: 0
11+
no-undef: 0
12+
no-unused-vars: 0
13+
linebreak-style: [2, unix]
14+
no-trailing-spaces: 2
15+
no-unneeded-ternary: 2
16+
quotes: [2, single, avoid-escape]
17+
semi: 2
18+
semi-spacing: 2
19+
mootools-indent: [2, tab, {SwitchCase: 1, VariableDeclarator: 1, IndentRootIIFE: false}]
20+
mootools-whitespace: 2

Grunt/options/build.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ module.exports = function(grunt){
6969
src: build.server.sources,
7070
dest: dir.build + '/mootools-core.js'
7171
}
72+
},
73+
eslint: {
74+
'compat': {
75+
src: ['Gruntfile.js', 'Grunt/{options,tasks}/*.js', build.compat.sources, build.compat.specs]
76+
},
77+
'nocompat': {
78+
src: ['Gruntfile.js', 'Grunt/{options,tasks}/*.js', build.nocompat.sources, build.nocompat.specs]
79+
},
80+
'server': {
81+
src: ['Gruntfile.js', 'Grunt/{options,tasks}/*.js', build.server.sources, build.server.specs]
82+
}
7283
}
7384
};
7485

Grunt/options/options.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ var path = require('path');
44
var browsers = require('./browsers');
55

66
module.exports = function(grunt){
7-
var dir = grunt.config.get('environment.dir'),
8-
build = grunt.config.get('environment.build'),
9-
travis = grunt.config.get('environment.travis'),
7+
var travis = grunt.config.get('environment.travis'),
108
sauceLabs = grunt.config.get('environment.sauceLabs');
119

1210
var config = {
@@ -46,6 +44,11 @@ module.exports = function(grunt){
4644
compress: true,
4745
preserveComments: 'some'
4846
}
47+
},
48+
eslint: {
49+
options: {
50+
rulePaths: ['Grunt/plugins/eslint/rules']
51+
}
4952
}
5053
};
5154

0 commit comments

Comments
 (0)