15 // See http://eslint.org/docs/rules/ for all rules and explanations of all
18 // === Possible Errors ===
19 'comma-dangle': 'off',
20 'no-compare-neg-zero': 'error',
21 'no-cond-assign': 'error',
22 'no-console': 'error',
23 'no-constant-condition': 'error',
24 'no-control-regex': 'error',
25 'no-debugger': 'error',
26 'no-dupe-args': 'error',
27 'no-dupe-keys': 'error',
28 'no-duplicate-case': 'error',
30 'no-empty-character-class': 'error',
31 'no-ex-assign': 'error',
32 'no-extra-boolean-cast': 'error',
33 'no-extra-parens': 'off',
34 'no-extra-semi': 'error',
35 'no-func-assign': 'error',
36 'no-inner-declarations': 'error',
37 'no-invalid-regexp': 'error',
38 'no-irregular-whitespace': 'error',
39 'no-obj-calls': 'error',
40 'no-prototype-builtins': 'off',
41 'no-regex-spaces': 'error',
42 'no-sparse-arrays': 'error',
43 'no-unexpected-multiline': 'error',
44 'no-unreachable': 'warn',
45 'no-unsafe-finally': 'error',
46 'no-unsafe-negation': 'error',
48 'valid-jsdoc': ['warn', { 'requireReturn': false, 'requireParamDescription': false, 'requireReturnDescription': false }],
49 'valid-typeof': 'error',
51 // === Best Practices ===
52 // (these mostly match our jshint config)
53 'array-callback-return': 'warn',
54 'block-scoped-var': 'warn',
56 'consistent-return': 'warn',
58 'dot-notation': 'warn',
61 'no-case-declarations': 'error',
62 'no-div-regex': 'error',
63 'no-empty-pattern': 'error',
64 'no-empty-function': 'warn',
65 'no-eq-null': 'error',
67 'no-extend-native': 'error',
68 'no-extra-bind': 'warn',
69 'no-fallthrough': 'error',
70 'no-floating-decimal': 'warn',
71 'no-global-assign': 'warn',
72 'no-implied-eval': 'error',
73 'no-invalid-this': 'error',
74 'no-iterator': 'error',
76 'no-loop-func': 'error',
77 'no-multi-spaces': 'warn',
78 'no-multi-str': 'error',
79 'no-new-func': 'error',
80 'no-new-wrappers': 'error',
82 'no-octal-escape': 'error',
84 'no-redeclare': 'warn',
85 'no-return-assign': 'error',
86 'no-script-url': 'error',
87 'no-self-assign': 'error',
88 'no-self-compare': 'error',
89 'no-sequences': 'warn',
90 'no-throw-literal': 'warn',
91 'no-unmodified-loop-condition': 'error',
92 'no-unused-expressions': 'error',
93 'no-unused-labels': 'error',
94 'no-useless-call': 'warn',
95 'no-useless-escape': 'warn',
97 'wrap-iife': ['error', 'any'],
100 'no-delete-var': 'error',
102 'no-undef-init': 'error',
103 'no-unused-vars': ['error', { 'caughtErrors': 'none' }],
105 // === Stylistic Issues ===
106 'array-bracket-spacing': 'warn',
107 'block-spacing': 'warn',
108 'brace-style': ['warn', '1tbs'],
110 'capitalized-comments': ['warn', 'always', { 'ignoreConsecutiveComments': true }],
111 'comma-spacing': ['warn', { 'before': false, 'after': true }],
112 'comma-style': ['warn', 'last'],
113 'computed-property-spacing': 'error',
114 'consistent-this': 'off',
116 'func-call-spacing': ['warn', 'never'],
119 // indent currently not doing well with our wrapping style, so disabled.
120 'indent': ['off', 4, { 'SwitchCase': 1 }],
121 'key-spacing': ['warn', { 'beforeColon': false, 'afterColon': true, 'mode': minimum }],
122 'keyword-spacing': 'warn',
123 'linebreak-style': ['error', 'unix'],
124 'lines-around-comment': 'off',
125 'max-len': ['error', 132],
128 'max-nested-callbacks': ['warn', 5],
130 'max-statements': 'off',
131 'max-statements-per-line': ['warn', { max: 2 }],
132 'new-cap': ['warn', { 'properties': false }],
133 'new-parens': 'warn',
134 'newline-after-var': 'off',
135 'newline-before-return': 'off',
136 'newline-per-chained-call': 'off',
137 'no-array-constructor': 'off',
138 'no-bitwise': 'error',
139 'no-continue': 'off',
140 'no-inline-comments': 'off',
141 'no-lonely-if': 'off',
142 'no-mixed-operators': 'off',
143 'no-mixed-spaces-and-tabs': 'error',
144 'no-multiple-empty-lines': 'warn',
145 'no-negated-condition': 'off',
146 'no-nested-ternary': 'warn',
147 'no-new-object': 'off',
148 'no-plusplus': 'off',
151 'no-trailing-spaces': 'error',
152 'no-underscore-dangle': 'off',
153 'no-unneeded-ternary': 'off',
154 'no-whitespace-before-property': 'warn',
155 'object-curly-newline': 'off',
156 'object-curly-spacing': 'warn',
157 'object-property-newline': 'off',
159 'one-var-declaration-per-line': ['warn', 'initializations'],
160 'operator-assignment': 'off',
161 'operator-linebreak': 'off',
162 'padded-blocks': 'off',
163 'quote-props': ['warn', 'as-needed', {'unnecessary': false, 'keywords': true, 'numbers': true}],
165 'require-jsdoc': 'warn',
167 'semi-spacing': ['warn', {'before': false, 'after': true}],
169 'space-before-blocks': 'warn',
170 'space-before-function-paren': ['warn', 'never'],
171 'space-in-parens': 'warn',
172 'space-infix-ops': 'warn',
173 'space-unary-ops': 'warn',
174 'spaced-comment': 'warn',
175 'unicode-bom': 'error',
179 'promise/always-return': 'warn',
180 'promise/no-return-wrap': 'warn',
181 'promise/param-names': 'warn',
182 'promise/catch-or-return': ['warn', {terminationMethod: ['catch', 'fail']}],
183 'promise/no-native': 'warn',
184 'promise/no-promise-in-callback': 'warn',
185 'promise/no-callback-in-promise': 'warn',
186 'promise/avoid-new': 'warn',
188 // === Deprecations ===
189 "no-restricted-properties": ['warn', {
192 'message': 'Use AMD module "core/str" or M.util.get_string()'
198 files: ["**/yui/src/**/*.js"],
199 // Disable some rules which we can't safely define for YUI rollups.
202 'no-unused-vars': 'off',
203 'no-unused-expressions': 'off'
207 files: ["**/amd/src/*.js", "**/amd/src/**/*.js", "Gruntfile*.js", "babel-plugin-add-module-to-define.js"],
208 // We support es6 now. Woot!
212 // We're using babel transpiling so use their parser
214 parser: 'babel-eslint',
215 // Check AMD with some slightly stricter rules.
217 'no-unused-vars': 'error',
218 'no-implicit-globals': 'error',
219 // Disable all of the rules that have babel versions.
221 // Not using this rule for the time being because it isn't
222 // compatible with jQuery and ES6.
223 'no-invalid-this': 'off',
224 'object-curly-spacing': 'off',
227 'no-unused-expressions': 'off',
228 // Enable all of the babel version of these rules.
229 'babel/new-cap': ['warn', { 'properties': false }],
230 // Not using this rule for the time being because it isn't
231 // compatible with jQuery and ES6.
232 'babel/no-invalid-this': 'off',
233 'babel/object-curly-spacing': 'warn',
234 // This is off in the original style int.
235 'babel/quotes': 'off',
236 'babel/semi': 'error',
237 'babel/no-unused-expressions': 'error',
239 // We have Promise now that we're using ES6.
240 'promise/no-native': 'off',
241 'promise/avoid-new': 'off'
245 'sourceType': 'module'