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-return-assign': 'error',
91 'no-script-url': 'error',
92 'no-self-assign': 'error',
93 'no-self-compare': 'error',
94 'no-sequences': 'warn',
95 'no-throw-literal': 'warn',
96 'no-unmodified-loop-condition': 'error',
97 'no-unused-expressions': 'error',
98 'no-unused-labels': 'error',
99 'no-useless-call': 'warn',
100 'no-useless-escape': 'warn',
102 'wrap-iife': ['error', 'any'],
105 'no-delete-var': 'error',
107 'no-undef-init': 'error',
108 'no-unused-vars': ['error', { 'caughtErrors': 'none' }],
110 // === Stylistic Issues ===
111 'array-bracket-spacing': 'warn',
112 'block-spacing': 'warn',
113 'brace-style': ['warn', '1tbs'],
115 'capitalized-comments': ['warn', 'always', { 'ignoreConsecutiveComments': true }],
116 'comma-spacing': ['warn', { 'before': false, 'after': true }],
117 'comma-style': ['warn', 'last'],
118 'computed-property-spacing': 'error',
119 'consistent-this': 'off',
121 'func-call-spacing': ['warn', 'never'],
124 // indent currently not doing well with our wrapping style, so disabled.
125 'indent': ['off', 4, { 'SwitchCase': 1 }],
126 'key-spacing': ['warn', { 'beforeColon': false, 'afterColon': true, 'mode': minimum }],
127 'keyword-spacing': 'warn',
128 'linebreak-style': ['error', 'unix'],
129 'lines-around-comment': 'off',
130 'max-len': ['error', 132],
133 'max-nested-callbacks': ['warn', 5],
135 'max-statements': 'off',
136 'max-statements-per-line': ['warn', { max: 2 }],
137 'new-cap': ['warn', { 'properties': false }],
138 'new-parens': 'warn',
139 'newline-after-var': 'off',
140 'newline-before-return': 'off',
141 'newline-per-chained-call': 'off',
142 'no-array-constructor': 'off',
143 'no-bitwise': 'error',
144 'no-continue': 'off',
145 'no-inline-comments': 'off',
146 'no-lonely-if': 'off',
147 'no-mixed-operators': 'off',
148 'no-mixed-spaces-and-tabs': 'error',
149 'no-multiple-empty-lines': 'warn',
150 'no-negated-condition': 'off',
151 'no-nested-ternary': 'warn',
152 'no-new-object': 'off',
153 'no-plusplus': 'off',
156 'no-trailing-spaces': 'error',
157 'no-underscore-dangle': 'off',
158 'no-unneeded-ternary': 'off',
159 'no-whitespace-before-property': 'warn',
160 'object-curly-newline': 'off',
161 'object-curly-spacing': 'warn',
162 'object-property-newline': 'off',
164 'one-var-declaration-per-line': ['warn', 'initializations'],
165 'operator-assignment': 'off',
166 'operator-linebreak': 'off',
167 'padded-blocks': 'off',
168 'quote-props': ['warn', 'as-needed', {'unnecessary': false, 'keywords': true, 'numbers': true}],
170 'require-jsdoc': 'warn',
172 'semi-spacing': ['warn', {'before': false, 'after': true}],
174 'space-before-blocks': 'warn',
175 'space-before-function-paren': ['warn', 'never'],
176 'space-in-parens': 'warn',
177 'space-infix-ops': 'warn',
178 'space-unary-ops': 'warn',
179 'spaced-comment': 'warn',
180 'unicode-bom': 'error',
184 'promise/always-return': 'warn',
185 'promise/no-return-wrap': 'warn',
186 'promise/param-names': 'warn',
187 'promise/catch-or-return': ['warn', {terminationMethod: ['catch', 'fail']}],
188 'promise/no-native': 'warn',
189 'promise/no-promise-in-callback': 'warn',
190 'promise/no-callback-in-promise': 'warn',
191 'promise/avoid-new': 'warn',
193 // === Deprecations ===
194 "no-restricted-properties": ['warn', {
197 'message': 'Use AMD module "core/str" or M.util.get_string()'
202 files: ["**/yui/src/**/*.js"],
204 // Disable ES6+ for YUI files.
207 // Disable some rules which we can't safely define for YUI rollups.
210 'no-unused-vars': 'off',
211 'no-unused-expressions': 'off',
214 "jsdoc/check-access": 'off',
215 "jsdoc/check-alignment": 'off',
216 "jsdoc/check-param-names": 'off',
217 "jsdoc/check-property-names": 'off',
218 "jsdoc/empty-tags": 'off',
219 "jsdoc/implements-on-classes": 'off',
220 "jsdoc/multiline-blocks": 'off',
221 "jsdoc/require-jsdoc": 'off',
222 "jsdoc/require-param": 'off',
223 "jsdoc/require-param-name": 'off',
224 "jsdoc/require-param-type": 'off',
225 "jsdoc/require-property": 'off',
226 "jsdoc/require-property-name": 'off',
227 "jsdoc/require-property-type": 'off',
231 files: ["**/amd/src/*.js", "**/amd/src/**/*.js", "Gruntfile.js", ".grunt/*.js", ".grunt/tasks/*.js", "jsdoc.conf.js"],
232 // We're using babel transpiling so use their parser
234 parser: '@babel/eslint-parser',
235 // Check AMD with some slightly stricter rules.
237 'no-unused-vars': 'error',
238 'no-implicit-globals': 'error',
239 // Disable all of the rules that have babel versions.
241 // Not using this rule for the time being because it isn't
242 // compatible with jQuery and ES6.
243 'no-invalid-this': 'off',
244 'object-curly-spacing': 'off',
247 'no-unused-expressions': 'off',
248 // Enable all of the babel version of these rules.
249 'babel/new-cap': ['warn', { 'properties': false }],
250 // Not using this rule for the time being because it isn't
251 // compatible with jQuery and ES6.
252 'babel/no-invalid-this': 'off',
253 'babel/object-curly-spacing': 'warn',
254 // This is off in the original style int.
255 'babel/quotes': 'off',
256 'babel/semi': 'error',
257 'babel/no-unused-expressions': 'error',
259 // We have Promise now that we're using ES6.
260 'promise/no-native': 'off',
261 'promise/avoid-new': 'off',
264 "jsdoc/check-access": [
267 "jsdoc/check-alignment": 1, // Recommended.
268 "jsdoc/check-param-names": [
271 "jsdoc/check-property-names": [
274 "jsdoc/empty-tags": [
277 "jsdoc/implements-on-classes": [
280 "jsdoc/multiline-blocks": [
283 "jsdoc/require-jsdoc": [
286 "jsdoc/require-param": [
289 "jsdoc/require-param-name": [
292 "jsdoc/require-param-type": [
295 "jsdoc/require-property": [
298 "jsdoc/require-property-name": [
301 "jsdoc/require-property-type": [
306 'sourceType': 'module',
307 'requireConfigFile': false,