From: Simon Brunel Date: Sat, 1 Jul 2017 07:55:11 +0000 (+0200) Subject: Increase ESLint complexity and add config for tests (#4421) X-Git-Tag: v2.7.0~1^2~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ecca3373b2aac74860fa35de79727fab8bf28494;p=thirdparty%2FChart.js.git Increase ESLint complexity and add config for tests (#4421) 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`). --- diff --git a/.eslintrc b/.eslintrc index 7acbf600a..fdf1951dd 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 22ba3b304..ff3cce5b6 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 000000000..5a281785c --- /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