From 3f2cbfff89123fa43fa3671b74b978c4c8196c0a Mon Sep 17 00:00:00 2001 From: Simon Brunel Date: Sat, 24 Jun 2017 19:11:18 +0200 Subject: [PATCH] Increase ESLint complexity and add config for tests 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`). --- .eslintrc | 2 +- gulpfile.js | 20 ++------------------ test/.eslintrc | 12 ++++++++++++ 3 files changed, 15 insertions(+), 19 deletions(-) create mode 100644 test/.eslintrc diff --git a/.eslintrc b/.eslintrc index 7acbf600a0d..fdf1951dd66 100644 --- a/.eslintrc +++ b/.eslintrc @@ -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 diff --git a/gulpfile.js b/gulpfile.js index 22ba3b304a7..ff3cce5b655 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -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) diff --git a/test/.eslintrc b/test/.eslintrc new file mode 100644 index 00000000000..5a281785c87 --- /dev/null +++ b/test/.eslintrc @@ -0,0 +1,12 @@ +env: + jasmine: true + +globals: + acquireChart: true + Chart: true + moment: true + +# http://eslint.org/docs/rules/ +rules: + # Best Practices + complexity: 0