Skip to content

Commit 0449bfa

Browse files
committed
Add eslint remove jshint (#7)
* Add eslint support and remove joshing * Resolve eslint issues * Add prefer-const rule
1 parent b686f8f commit 0449bfa

File tree

111 files changed

+1190
-779
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+1190
-779
lines changed

.eslintrc.json

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

.jshintrc

Lines changed: 0 additions & 12 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ Run `node src/cli.js`
3131

3232
### JS
3333

34-
npm package json lint utilizes both JSHint and JSCS to enforce JavaScript standards. Please see the `.jshintrc` file for JSHint config and `.jscsrc` for JSCS config.
34+
npm package json lint utilizes both ESLint and JSCS to enforce JavaScript standards. Please see the `.eslintrc.json` file for ESLint config and `.jscsrc` for JSCS config.
3535

36-
* [grunt-contrib-jshint](https://github.com/gruntjs/grunt-contrib-jshint)
36+
* [grunt-eslint](https://github.com/sindresorhus/grunt-eslint)
3737
* [grunt-jscs](https://github.com/jscs-dev/grunt-jscs)
3838

3939
#### JSON

Gruntfile.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ module.exports = function(grunt) {
33
grunt.initConfig({
44
pkg: grunt.file.readJSON("package.json")
55
});
6+
67
// Load Grunt plugins from the config files in the grunt/ directory
78
grunt.loadTasks("grunt");
89
require("time-grunt")(grunt);
910

1011
// Register task for running linters
1112
grunt.registerTask("lint", [
1213
"jsonlint",
13-
"jshint",
14-
"jscs"
14+
"jscs",
15+
"eslint"
1516
]);
1617

1718
// Register task for coverage

grunt/clean.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
/**
2-
* Cleans the dist directory (deletes all files)
3-
*/
1+
// Cleans the dist directory (deletes all files)
42
module.exports = function(grunt) {
53

64
grunt.config("clean", {

grunt/coverage-check.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
/**
2-
* Checks to ensure the test coverage meets the minimum thresholds below
3-
*/
1+
// Checks to ensure the test coverage meets the minimum thresholds below
42
module.exports = function(grunt) {
53

64
grunt.config("coverage", {

grunt/env.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module.exports = function(grunt) {
22

33
grunt.config("env", {
44
coverage: {
5-
SRC_DIR_FOR_CODE_COVERAGE: "../tests/coverage/instrument/src/"
5+
SRC_DIR_FOR_CODE_COV: "../tests/coverage/instrument/src/"
66
}
77
});
88

grunt/eslint.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = function(grunt) {
2+
grunt.config("eslint", {
3+
options: {
4+
configFile: ".eslintrc.json",
5+
format: "node_modules/eslint-formatter-pretty"
6+
},
7+
javascript: [
8+
"src/**/*.js",
9+
"grunt/*.js",
10+
"tests/unit/**/*.js",
11+
"*.js"
12+
]
13+
});
14+
15+
grunt.loadNpmTasks("grunt-eslint");
16+
};

grunt/jshint.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

grunt/jsonlint.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ module.exports = function(grunt) {
88
"tests/unit/**/*.json",
99
"*.json",
1010
".jscsrc",
11-
".jshintrc",
1211
".npmpackagejsonlintrc"
1312
]
1413
}

0 commit comments

Comments
 (0)