Skip to content

Commit cccf821

Browse files
committed
Code Climate and eslint integration
1 parent 8909799 commit cccf821

File tree

7 files changed

+245
-2
lines changed

7 files changed

+245
-2
lines changed

.codeclimate.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
engines:
3+
duplication:
4+
enabled: true
5+
config:
6+
languages:
7+
- javascript
8+
eslint:
9+
enabled: true
10+
channel: "eslint-2"
11+
fixme:
12+
enabled: true
13+
ratings:
14+
paths:
15+
- "src/**/*.js"
16+
exclude_paths: []

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/*{.,-}min.js

.eslintrc

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
ecmaFeatures:
2+
modules: true
3+
jsx: true
4+
5+
env:
6+
amd: true
7+
browser: true
8+
es6: true
9+
jquery: true
10+
node: true
11+
12+
# http://eslint.org/docs/rules/
13+
rules:
14+
# Possible Errors
15+
comma-dangle: [2, never]
16+
no-cond-assign: 2
17+
no-console: 0
18+
no-constant-condition: 2
19+
no-control-regex: 2
20+
no-debugger: 2
21+
no-dupe-args: 2
22+
no-dupe-keys: 2
23+
no-duplicate-case: 2
24+
no-empty: 2
25+
no-empty-character-class: 2
26+
no-ex-assign: 2
27+
no-extra-boolean-cast: 2
28+
no-extra-parens: 0
29+
no-extra-semi: 2
30+
no-func-assign: 2
31+
no-inner-declarations: [2, functions]
32+
no-invalid-regexp: 2
33+
no-irregular-whitespace: 2
34+
no-negated-in-lhs: 2
35+
no-obj-calls: 2
36+
no-regex-spaces: 2
37+
no-sparse-arrays: 2
38+
no-unexpected-multiline: 2
39+
no-unreachable: 2
40+
use-isnan: 2
41+
valid-jsdoc: 0
42+
valid-typeof: 2
43+
44+
# Best Practices
45+
accessor-pairs: 2
46+
block-scoped-var: 0
47+
complexity: [2, 6]
48+
consistent-return: 0
49+
curly: 0
50+
default-case: 0
51+
dot-location: 0
52+
dot-notation: 0
53+
eqeqeq: 2
54+
guard-for-in: 2
55+
no-alert: 2
56+
no-caller: 2
57+
no-case-declarations: 2
58+
no-div-regex: 2
59+
no-else-return: 0
60+
no-empty-pattern: 2
61+
no-eq-null: 2
62+
no-eval: 2
63+
no-extend-native: 2
64+
no-extra-bind: 2
65+
no-fallthrough: 2
66+
no-floating-decimal: 0
67+
no-implicit-coercion: 0
68+
no-implied-eval: 2
69+
no-invalid-this: 0
70+
no-iterator: 2
71+
no-labels: 0
72+
no-lone-blocks: 2
73+
no-loop-func: 2
74+
no-magic-number: 0
75+
no-multi-spaces: 0
76+
no-multi-str: 0
77+
no-native-reassign: 2
78+
no-new-func: 2
79+
no-new-wrappers: 2
80+
no-new: 2
81+
no-octal-escape: 2
82+
no-octal: 2
83+
no-proto: 2
84+
no-redeclare: 2
85+
no-return-assign: 2
86+
no-script-url: 2
87+
no-self-compare: 2
88+
no-sequences: 0
89+
no-throw-literal: 0
90+
no-unused-expressions: 2
91+
no-useless-call: 2
92+
no-useless-concat: 2
93+
no-void: 2
94+
no-warning-comments: 0
95+
no-with: 2
96+
radix: 2
97+
vars-on-top: 0
98+
wrap-iife: [2, any]
99+
yoda: 0
100+
101+
# Strict
102+
strict: 0
103+
104+
# Variables
105+
init-declarations: 0
106+
no-catch-shadow: 2
107+
no-delete-var: 2
108+
no-label-var: 2
109+
no-shadow-restricted-names: 2
110+
no-shadow: 0
111+
no-undef-init: 2
112+
no-undef: 0
113+
no-undefined: 0
114+
no-unused-vars: 0
115+
no-use-before-define: 0
116+
117+
# Node.js and CommonJS
118+
callback-return: 2
119+
global-require: 2
120+
handle-callback-err: 2
121+
no-mixed-requires: 0
122+
no-new-require: 0
123+
no-path-concat: 2
124+
no-process-exit: 2
125+
no-restricted-modules: 0
126+
no-sync: 0
127+
128+
# Stylistic Issues
129+
array-bracket-spacing: 0
130+
block-spacing: 0
131+
brace-style: 0
132+
camelcase: 0
133+
comma-spacing: 0
134+
comma-style: 0
135+
computed-property-spacing: 0
136+
consistent-this: 0
137+
eol-last: 0
138+
func-names: 0
139+
func-style: 0
140+
id-length: 0
141+
id-match: 0
142+
indent: 0
143+
jsx-quotes: 0
144+
key-spacing: 0
145+
linebreak-style: 0
146+
lines-around-comment: 0
147+
max-depth: 0
148+
max-len: 0
149+
max-nested-callbacks: 0
150+
max-params: 0
151+
max-statements: [2, 30]
152+
new-cap: 0
153+
new-parens: 0
154+
newline-after-var: 0
155+
no-array-constructor: 0
156+
no-bitwise: 0
157+
no-continue: 0
158+
no-inline-comments: 0
159+
no-lonely-if: 0
160+
no-mixed-spaces-and-tabs: 0
161+
no-multiple-empty-lines: 0
162+
no-negated-condition: 0
163+
no-nested-ternary: 0
164+
no-new-object: 0
165+
no-plusplus: 0
166+
no-restricted-syntax: 0
167+
no-spaced-func: 0
168+
no-ternary: 0
169+
no-trailing-spaces: 0
170+
no-underscore-dangle: 0
171+
no-unneeded-ternary: 0
172+
object-curly-spacing: 0
173+
one-var: 0
174+
operator-assignment: 0
175+
operator-linebreak: 0
176+
padded-blocks: 0
177+
quote-props: 0
178+
quotes: 0
179+
require-jsdoc: 0
180+
semi-spacing: 0
181+
semi: 0
182+
sort-vars: 0
183+
space-after-keywords: 0
184+
space-before-blocks: 0
185+
space-before-function-paren: 0
186+
space-before-keywords: 0
187+
space-in-parens: 0
188+
space-infix-ops: 0
189+
space-return-throw-case: 0
190+
space-unary-ops: 0
191+
spaced-comment: 0
192+
wrap-regex: 0
193+
194+
# ECMAScript 6
195+
arrow-body-style: 0
196+
arrow-parens: 0
197+
arrow-spacing: 0
198+
constructor-super: 0
199+
generator-star-spacing: 0
200+
no-arrow-condition: 0
201+
no-class-assign: 0
202+
no-const-assign: 0
203+
no-dupe-class-members: 0
204+
no-this-before-super: 0
205+
no-var: 0
206+
object-shorthand: 0
207+
prefer-arrow-callback: 0
208+
prefer-const: 0
209+
prefer-reflect: 0
210+
prefer-spread: 0
211+
prefer-template: 0
212+
require-yield: 0

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ node_js:
44

55
script:
66
- gulp build
7+
- gulp lint
78

89
deploy:
910
provider: releases

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Chart.Deferred.js
22

3-
[![Build Status](https://travis-ci.org/chartjs/Chart.Deferred.js.svg?branch=master)](https://travis-ci.org/chartjs/Chart.Deferred.js)
3+
[![Build Status](https://travis-ci.org/chartjs/Chart.Deferred.js.svg?branch=master)](https://travis-ci.org/chartjs/Chart.Deferred.js) [![Code Climate](https://codeclimate.com/github/chartjs/Chart.Deferred.js/badges/gpa.svg)](https://codeclimate.com/github/chartjs/Chart.Deferred.js)
44

55
A [Chart.js](http://www.chartjs.org/) plugin to defer the initial chart update until the user scrolls and the canvas appears inside the viewport. The main intent of Chart.Deferred.js is to trigger the initial chart animations when the user is likely to see them.
66

@@ -44,6 +44,7 @@ The following commands are available from the repository root (requires [Node.js
4444
> npm install // initialize node dependencies
4545
> gulp build // build dist files
4646
> gulp build --watch // build and watch for changes
47+
> gulp lint // perform code linting
4748
```
4849

4950
## License

gulpfile.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var argv = require('yargs').argv
22
var gulp = require('gulp');
3+
var eslint = require('gulp-eslint');
34
var insert = require('gulp-insert');
45
var rename = require('gulp-rename');
56
var replace = require('gulp-replace');
@@ -23,14 +24,16 @@ var header = "/*!\n\
2324
*/\n";
2425

2526
gulp.task('build', buildTask);
27+
gulp.task('lint', lintTask);
2628
gulp.task('default', ['build']);
2729

2830
function watch(glob, task) {
2931
gutil.log('Waiting for changes...');
3032
return gulp.watch(glob, function(e) {
3133
gutil.log('Changes detected for', path.relative('.', e.path), '(' + e.type + ')');
32-
task();
34+
var r = task();
3335
gutil.log('Waiting for changes...');
36+
return r;
3437
});
3538
}
3639

@@ -52,3 +55,11 @@ function buildTask() {
5255
return task();
5356
}
5457
}
58+
59+
function lintTask() {
60+
var files = [srcDir + '**/*.js'];
61+
return gulp.src(files)
62+
.pipe(eslint())
63+
.pipe(eslint.format())
64+
.pipe(eslint.failAfterError());
65+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
},
1212
"devDependencies": {
1313
"gulp": "^3.9.1",
14+
"gulp-eslint": "^2.0.0",
1415
"gulp-insert": "^0.5.0",
1516
"gulp-replace": "^0.5.4",
1617
"gulp-rename": "^1.2.2",

0 commit comments

Comments
 (0)