-
Notifications
You must be signed in to change notification settings - Fork 27.4k
chore(*): switch from JSHint/JSCS to ESLint (+ other build-related changes) #14952
Changes from all commits
3134e78
0606b15
bdb794e
b1c6650
6f73729
8c00386
517b9bd
30c027e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
bower_components/** | ||
build/** | ||
docs/bower_components/** | ||
docs/app/assets/js/angular-bootstrap/** | ||
docs/config/templates/** | ||
node_modules/** | ||
lib/htmlparser/** | ||
src/angular.bind.js | ||
src/ngParseExt/ucd.js | ||
i18n/closure/** | ||
tmp/** |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
{ | ||
"rules": { | ||
// Rules are divided into sections from http://eslint.org/docs/rules/ | ||
|
||
// Possible errors | ||
"comma-dangle": ["error", "never"], | ||
"no-cond-assign": ["error", "except-parens"], | ||
"no-constant-condition": ["error", {"checkLoops": false}], | ||
"no-control-regex": "error", | ||
"no-debugger": "error", | ||
"no-dupe-args": "error", | ||
"no-dupe-keys": "error", | ||
"no-duplicate-case": "error", | ||
"no-empty-character-class": "error", | ||
"no-empty": "error", | ||
"no-ex-assign": "error", | ||
"no-extra-boolean-cast": "error", | ||
"no-extra-semi": "error", | ||
"no-func-assign": "error", | ||
"no-inner-declarations": "error", | ||
"no-invalid-regexp": "error", | ||
"no-irregular-whitespace": "error", | ||
"no-negated-in-lhs": "error", | ||
"no-obj-calls": "error", | ||
"no-regex-spaces": "error", | ||
"no-sparse-arrays": "error", | ||
"no-unreachable": "error", | ||
"use-isnan": "error", | ||
"no-unsafe-finally": "error", | ||
"valid-typeof": "error", | ||
"no-unexpected-multiline": "error", | ||
|
||
// Best practices | ||
"accessor-pairs": "error", | ||
"array-callback-return": "error", | ||
"eqeqeq": ["error", "allow-null"], | ||
"no-alert": "error", | ||
"no-caller": "error", | ||
"no-case-declarations": "error", | ||
"no-eval": "error", | ||
"no-extend-native": "error", | ||
"no-extra-bind": "error", | ||
"no-extra-label": "error", | ||
"no-fallthrough": "error", | ||
"no-floating-decimal": "error", | ||
"no-implied-eval": "error", | ||
"no-invalid-this": "error", | ||
"no-iterator": "error", | ||
"no-multi-str": "error", | ||
"no-new-func": "error", | ||
"no-new-wrappers": "error", | ||
"no-new": "error", | ||
"no-octal-escape": "error", | ||
"no-octal": "error", | ||
"no-proto": "error", | ||
"no-redeclare": "error", | ||
"no-return-assign": "error", | ||
"no-script-url": "error", | ||
"no-self-assign": "error", | ||
"no-self-compare": "error", | ||
"no-sequences": "error", | ||
"no-throw-literal": "error", | ||
"no-unmodified-loop-condition": "error", | ||
"no-unused-expressions": "error", | ||
"no-unused-labels": "error", | ||
"no-useless-call": "error", | ||
"no-useless-concat": "error", | ||
"no-useless-escape": "error", | ||
"no-void": "error", | ||
"no-with": "error", | ||
"radix": "error", | ||
"wrap-iife": ["error", "inside"], | ||
|
||
// Strict mode | ||
"strict": ["error", "global"], | ||
|
||
// Variables | ||
"no-delete-var": "error", | ||
"no-label-var": "error", | ||
"no-restricted-globals": ["error", "event"], | ||
"no-shadow-restricted-names": "error", | ||
"no-undef-init": "error", | ||
"no-undef": "error", | ||
"no-unused-vars": ["error", { "vars": "local", "args": "none" }], | ||
|
||
// Node.js | ||
"handle-callback-err": "error", | ||
|
||
// Stylistic issues | ||
"array-bracket-spacing": ["error", "never"], | ||
"brace-style": ["error", "1tbs", { "allowSingleLine": true }], | ||
"comma-style": ["error", "last"], | ||
"eol-last": "error", | ||
"keyword-spacing": "error", | ||
"linebreak-style": ["error", "unix"], | ||
"max-len": ["error", { "code": 200, "ignoreComments": true, "ignoreUrls": true }], | ||
"new-cap": "error", | ||
"new-parens": "error", | ||
"no-array-constructor": "error", | ||
"no-bitwise": "error", | ||
"no-mixed-spaces-and-tabs": "error", | ||
"no-multiple-empty-lines": ["error", { "max": 3, "maxEOF": 1 }], | ||
"no-whitespace-before-property": "error", | ||
"no-spaced-func": "error", | ||
"no-trailing-spaces": "error", | ||
"no-unneeded-ternary": "error", | ||
"semi-spacing": "error", | ||
"semi": "error", | ||
"space-before-blocks": ["error", "always"], | ||
"space-before-function-paren": ["error", "never"], | ||
"space-in-parens": ["error", "never"], | ||
"space-infix-ops": "error", | ||
"space-unary-ops": ["error", { "words": true, "nonwords": false }], | ||
"unicode-bom": ["error", "never"] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"extends": "./.eslintrc-base.json", | ||
|
||
"env": { | ||
// Note: don't set `"browser": true`; code in "src/" should be compatible with | ||
// non-browser environments like Node.js with a custom window implementation | ||
// like jsdom. All browser globals should be taken from window. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would be happier if this didn't affect tests tbh 😕 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
My thinking was that we might not want to make it harder to run unit tests There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, it's not that bad. It's just an extra constraint that we have (and need to remember), which doesn't buy us much (we don't care about unit tests in non-browser environments). But I am fine leaving it as is. |
||
"browser": false, | ||
"node": false | ||
}, | ||
|
||
"globals": { | ||
"window": false, | ||
|
||
"angular": false | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": "./.eslintrc-base.json", | ||
|
||
"env": { | ||
"browser": false, | ||
"node": true | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
// This config contains proposed rules that we'd like to have enabled but haven't | ||
// converted the code to adhere yet. If a decision comes to not enable one of these | ||
// rules, it should be removed from the file. Every rule that got enabled in the | ||
// end should be moved from here to a respective section in .eslintrc.json | ||
|
||
"rules": { | ||
// Rules are divided into sections from http://eslint.org/docs/rules/ | ||
|
||
// Best practices | ||
"complexity": ["error", 10], | ||
"dot-notation": "error", | ||
"dot-location": ["error", "property"], | ||
|
||
// Stylistic issues | ||
"block-spacing": ["error", "always"], | ||
"comma-spacing": "error", | ||
"id-blacklist": ["error", "event"], | ||
"indent": ["error", 2], | ||
"key-spacing": ["error", { "beforeColon": false, "afterColon": true, "mode": "minimum" }], | ||
"object-curly-spacing": ["error", "never"], | ||
"object-property-newline": ["error", { "allowMultiplePropertiesPerLine": true }], | ||
"operator-linebreak": ["error", "after", { "overrides": { "?": "before", ":": "before" }}], | ||
"quotes": ["error", "single"] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"root": true, | ||
"extends": "./.eslintrc-node.json" | ||
} |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
4 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar change is needed in
Gruntfile.js
.