]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Increase ESLint complexity and add config for tests (#4421)
authorSimon Brunel <simonbrunel@users.noreply.github.com>
Sat, 1 Jul 2017 07:55:11 +0000 (09:55 +0200)
committerGitHub <noreply@github.com>
Sat, 1 Jul 2017 07:55:11 +0000 (09:55 +0200)
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
gulpfile.js
test/.eslintrc [new file with mode: 0644]

index 7acbf600a0d2628a7e2c1c25ba6f72d54426d9b7..fdf1951dd665ddb41e9ef7ccfe7b61c02a12c577 100644 (file)
--- 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
index 22ba3b304a75b0bebde45dac95f4850f1f77bc32..ff3cce5b6554c2bab0c6ad42713b4964ec708d7a 100644 (file)
@@ -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 (file)
index 0000000..5a28178
--- /dev/null
@@ -0,0 +1,12 @@
+env:
+  jasmine: true
+
+globals:
+  acquireChart: true
+  Chart: true
+  moment: true
+
+# http://eslint.org/docs/rules/
+rules:
+  # Best Practices
+  complexity: 0