9 // Enable ES6+ features by default.
10 // See http://eslint.org/docs/user-guide/configuring#specifying-environments
11 // Note: The YUI override must exactly match this when disabling the ES6+ version because those features are not supported by Shifter.
20 // See http://eslint.org/docs/rules/ for all rules and explanations of all
23 // === Possible Errors ===
24 'comma-dangle': 'off',
25 'no-compare-neg-zero': 'error',
26 'no-cond-assign': 'error',
27 'no-console': 'error',
28 'no-constant-condition': 'error',
29 'no-control-regex': 'error',
30 'no-debugger': 'error',
31 'no-dupe-args': 'error',
32 'no-dupe-keys': 'error',
33 'no-duplicate-case': 'error',
35 'no-empty-character-class': 'error',
36 'no-ex-assign': 'error',
37 'no-extra-boolean-cast': 'error',
38 'no-extra-parens': 'off',
39 'no-extra-semi': 'error',
40 'no-func-assign': 'error',
41 'no-inner-declarations': 'error',
42 'no-invalid-regexp': 'error',
43 'no-irregular-whitespace': 'error',
44 'no-obj-calls': 'error',
45 'no-prototype-builtins': 'off',
46 'no-regex-spaces': 'error',
47 'no-sparse-arrays': 'error',
48 'no-unexpected-multiline': 'error',
49 'no-unreachable': 'warn',
50 'no-unsafe-finally': 'error',
51 'no-unsafe-negation': 'error',
53 'valid-jsdoc': ['warn', { 'requireReturn': false, 'requireParamDescription': false, 'requireReturnDescription': false }],
54 'valid-typeof': 'error',
56 // === Best Practices ===
57 // (these mostly match our jshint config)
58 'array-callback-return': 'warn',
59 'block-scoped-var': 'warn',
61 'consistent-return': 'warn',
63 'dot-notation': 'warn',
66 'no-case-declarations': 'error',
67 'no-div-regex': 'error',
68 'no-empty-pattern': 'error',
69 'no-empty-function': 'warn',
70 'no-eq-null': 'error',
72 'no-extend-native': 'error',
73 'no-extra-bind': 'warn',
74 'no-fallthrough': 'error',
75 'no-floating-decimal': 'warn',
76 'no-global-assign': 'warn',
77 'no-implied-eval': 'error',
78 'no-invalid-this': 'error',
79 'no-iterator': 'error',
81 'no-loop-func': 'error',
82 'no-multi-spaces': 'warn',
83 'no-multi-str': 'error',
84 'no-new-func': 'error',
85 'no-new-wrappers': 'error',
87 'no-octal-escape': 'error',
89 'no-redeclare': 'warn',
90 'no-restricted-globals': ['error', { 'name': 'Notification' }],
91 'no-return-assign': 'error',
92 'no-script-url': 'error',
93 'no-self-assign': 'error',
94 'no-self-compare': 'error',
95 'no-sequences': 'warn',
96 'no-throw-literal': 'warn',
97 'no-unmodified-loop-condition': 'error',
98 'no-unused-expressions': 'error',
99 'no-unused-labels': 'error',
100 'no-useless-call': 'warn',
101 'no-useless-escape': 'warn',
103 'wrap-iife': ['error', 'any'],
106 'no-delete-var': 'error',
108 'no-undef-init': 'error',
109 'no-unused-vars': ['error', { 'caughtErrors': 'none' }],
111 // === Stylistic Issues ===
112 'array-bracket-spacing': 'warn',
113 'block-spacing': 'warn',
114 'brace-style': ['warn', '1tbs'],
116 'capitalized-comments': ['warn', 'always', { 'ignoreConsecutiveComments': true }],
117 'comma-spacing': ['warn', { 'before': false, 'after': true }],
118 'comma-style': ['warn', 'last'],
119 'computed-property-spacing': 'error',
120 'consistent-this': 'off',
122 'func-call-spacing': ['warn', 'never'],
125 // indent currently not doing well with our wrapping style, so disabled.
126 'indent': ['off', 4, { 'SwitchCase': 1 }],
127 'key-spacing': ['warn', { 'beforeColon': false, 'afterColon': true, 'mode': minimum }],
128 'keyword-spacing': 'warn',
129 'linebreak-style': ['error', 'unix'],
130 'lines-around-comment': 'off',
131 'max-len': ['error', 132],
134 'max-nested-callbacks': ['warn', 5],
136 'max-statements': 'off',
137 'max-statements-per-line': ['warn', { max: 2 }],
138 'new-cap': ['warn', { 'properties': false }],
139 'new-parens': 'warn',
140 'newline-after-var': 'off',
141 'newline-before-return': 'off',
142 'newline-per-chained-call': 'off',
143 'no-array-constructor': 'off',
144 'no-bitwise': 'error',
145 'no-continue': 'off',
146 'no-inline-comments': 'off',
147 'no-lonely-if': 'off',
148 'no-mixed-operators': 'off',
149 'no-mixed-spaces-and-tabs': 'error',
150 'no-multiple-empty-lines': 'warn',
151 'no-negated-condition': 'off',
152 'no-nested-ternary': 'warn',
153 'no-new-object': 'off',
154 'no-plusplus': 'off',
157 'no-trailing-spaces': 'error',
158 'no-underscore-dangle': 'off',
159 'no-unneeded-ternary': 'off',
160 'no-whitespace-before-property': 'warn',
161 'object-curly-newline': 'off',
162 'object-curly-spacing': 'warn',
163 'object-property-newline': 'off',
165 'one-var-declaration-per-line': ['warn', 'initializations'],
166 'operator-assignment': 'off',
167 'operator-linebreak': 'off',
168 'padded-blocks': 'off',
169 'quote-props': ['warn', 'as-needed', {'unnecessary': false, 'keywords': true, 'numbers': true}],
171 'require-jsdoc': 'warn',
173 'semi-spacing': ['warn', {'before': false, 'after': true}],
175 'space-before-blocks': 'warn',
176 'space-before-function-paren': ['warn', 'never'],
177 'space-in-parens': 'warn',
178 'space-infix-ops': 'warn',
179 'space-unary-ops': 'warn',
180 'spaced-comment': 'warn',
181 'unicode-bom': 'error',
185 'promise/always-return': 'warn',
186 'promise/no-return-wrap': 'warn',
187 'promise/param-names': 'warn',
188 'promise/catch-or-return': ['warn', {terminationMethod: ['catch', 'fail', 'always'], allowFinally: true}],
189 'promise/no-native': 'warn',
190 'promise/no-promise-in-callback': 'warn',
191 'promise/no-callback-in-promise': 'warn',
192 'promise/avoid-new': 'warn',
194 // === Deprecations ===
195 "no-restricted-properties": ['warn', {
198 'message': 'Use AMD module "core/str" or M.util.get_string()'
203 files: ["**/yui/src/**/*.js"],
205 // Disable ES6+ for YUI files.
208 // Disable some rules which we can't safely define for YUI rollups.
211 'no-unused-vars': 'off',
212 'no-unused-expressions': 'off',
215 "jsdoc/check-access": 'off',
216 "jsdoc/check-alignment": 'off',
217 "jsdoc/check-param-names": 'off',
218 "jsdoc/check-property-names": 'off',
219 "jsdoc/empty-tags": 'off',
220 "jsdoc/implements-on-classes": 'off',
221 "jsdoc/multiline-blocks": 'off',
222 "jsdoc/require-jsdoc": 'off',
223 "jsdoc/require-param": 'off',
224 "jsdoc/require-param-name": 'off',
225 "jsdoc/require-param-type": 'off',
226 "jsdoc/require-property": 'off',
227 "jsdoc/require-property-name": 'off',
228 "jsdoc/require-property-type": 'off',
232 files: ["**/amd/src/*.js", "**/amd/src/**/*.js", "Gruntfile.js", ".grunt/*.js", ".grunt/tasks/*.js", "jsdoc.conf.js"],
233 // We're using babel transpiling so use their parser
235 parser: '@babel/eslint-parser',
236 // Check AMD with some slightly stricter rules.
238 'no-unused-vars': 'error',
239 'no-implicit-globals': 'error',
240 // Disable all of the rules that have babel versions.
242 // Not using this rule for the time being because it isn't
243 // compatible with jQuery and ES6.
244 'no-invalid-this': 'off',
245 'object-curly-spacing': 'off',
248 'no-unused-expressions': 'off',
249 // Enable all of the babel version of these rules.
250 'babel/new-cap': ['warn', { 'properties': false }],
251 // Not using this rule for the time being because it isn't
252 // compatible with jQuery and ES6.
253 'babel/no-invalid-this': 'off',
254 'babel/object-curly-spacing': 'warn',
255 // This is off in the original style int.
256 'babel/quotes': 'off',
257 'babel/semi': 'error',
258 'babel/no-unused-expressions': 'error',
260 // We have Promise now that we're using ES6.
261 'promise/no-native': 'off',
262 'promise/avoid-new': 'off',
265 "jsdoc/check-access": [
268 "jsdoc/check-alignment": 1, // Recommended.
269 "jsdoc/check-param-names": [
272 "jsdoc/check-property-names": [
275 "jsdoc/empty-tags": [
278 "jsdoc/implements-on-classes": [
281 "jsdoc/multiline-blocks": [
284 "jsdoc/require-jsdoc": [
287 "jsdoc/require-param": [
290 "jsdoc/require-param-name": [
293 "jsdoc/require-param-type": [
296 "jsdoc/require-property": [
299 "jsdoc/require-property-name": [
302 "jsdoc/require-property-type": [
307 'sourceType': 'module',
308 'requireConfigFile': false,