Skip to content

Commit

Permalink
Increase ESLint complexity and add config for tests (chartjs#4421)
Browse files Browse the repository at this point in the history
Raise the cyclomatic complexity to 10 which seems to better match the project coding style and still reasonable (6 being quite low). Also move unit tests specific eslint rules in the cascaded `./test/.eslintrc` file (previously in `gulp.js`).
  • Loading branch information
simonbrunel authored and yofreke committed Dec 30, 2017
1 parent d4241b7 commit 8c3bf9e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ rules:
accessor-pairs: 2
array-callback-return: 0
block-scoped-var: 0
complexity: [2, 6]
complexity: [2, 10]
consistent-return: 0
curly: [2, all]
default-case: 2
Expand Down
20 changes: 2 additions & 18 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,25 +137,9 @@ function lintTask() {
// to fix, let's turn them as warnings and rewrite code later progressively.
var options = {
rules: {
'complexity': [1, 6],
'complexity': [1, 10],
'max-statements': [1, 30]
},
globals: [
'Chart',
'acquireChart',
'afterAll',
'afterEach',
'beforeAll',
'beforeEach',
'describe',
'expect',
'fail',
'it',
'jasmine',
'moment',
'spyOn',
'xit'
]
}
};

return gulp.src(files)
Expand Down
12 changes: 12 additions & 0 deletions test/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
env:
jasmine: true

globals:
acquireChart: true
Chart: true
moment: true

# http://eslint.org/docs/rules/
rules:
# Best Practices
complexity: 0

0 comments on commit 8c3bf9e

Please sign in to comment.