9 'plugin:promise/recommended'
13 // Enable ES6+ features by default.
14 // See http://eslint.org/docs/user-guide/configuring#specifying-environments
15 // Note: The YUI override must exactly match this when disabling the ES6+ version because those features are not supported by Shifter.
23 // Warn about unused eslint-disable statements.
24 'reportUnusedDisableDirectives': true,
26 // See http://eslint.org/docs/rules/ for all rules and explanations of all
29 // === Possible Errors ===
30 'comma-dangle': 'off',
31 'no-console': 'error',
33 'no-extra-parens': 'off',
34 'no-prototype-builtins': 'off',
35 'no-unreachable': 'warn',
37 // === Best Practices ===
38 // (these mostly match our jshint config)
39 'array-callback-return': 'warn',
40 'block-scoped-var': 'warn',
42 'consistent-return': 'warn',
44 'dot-notation': 'warn',
47 'no-div-regex': 'error',
48 'no-empty-function': 'warn',
49 'no-eq-null': 'error',
51 'no-extend-native': 'error',
52 'no-extra-bind': 'warn',
53 'no-floating-decimal': 'warn',
54 'no-global-assign': 'warn',
55 'no-implied-eval': 'error',
56 'no-invalid-this': 'error',
57 'no-iterator': 'error',
59 'no-loop-func': 'error',
60 'no-multi-spaces': 'warn',
61 'no-multi-str': 'error',
62 'no-new-func': 'error',
63 'no-new-wrappers': 'error',
64 'no-octal-escape': 'error',
66 'no-redeclare': 'warn',
67 'no-restricted-globals': ['error', { 'name': 'Notification' }],
68 'no-return-assign': 'error',
69 'no-script-url': 'error',
70 'no-self-compare': 'error',
71 'no-sequences': 'warn',
72 'no-throw-literal': 'warn',
73 'no-unmodified-loop-condition': 'error',
74 'no-unused-expressions': 'error',
75 'no-useless-call': 'warn',
76 'no-useless-escape': 'warn',
77 'wrap-iife': ['error', 'any'],
80 'no-undef-init': 'error',
81 'no-unused-vars': ['error', { 'caughtErrors': 'none' }],
83 // === Stylistic Issues ===
84 'array-bracket-spacing': 'warn',
85 'block-spacing': 'warn',
86 'brace-style': ['warn', '1tbs'],
88 'capitalized-comments': ['warn', 'always', { 'ignoreConsecutiveComments': true }],
89 'comma-spacing': ['warn', { 'before': false, 'after': true }],
90 'comma-style': ['warn', 'last'],
91 'computed-property-spacing': 'error',
92 'consistent-this': 'off',
94 'func-call-spacing': ['warn', 'never'],
97 // indent currently not doing well with our wrapping style, so disabled.
98 'indent': ['off', 4, { 'SwitchCase': 1 }],
99 'key-spacing': ['warn', { 'beforeColon': false, 'afterColon': true, 'mode': minimum }],
100 'keyword-spacing': 'warn',
101 'linebreak-style': ['error', 'unix'],
102 'lines-around-comment': 'off',
103 'max-len': ['error', 132],
106 'max-nested-callbacks': ['warn', 5],
108 'max-statements': 'off',
109 'max-statements-per-line': ['warn', { max: 2 }],
110 'new-cap': ['warn', { 'properties': false }],
111 'new-parens': 'warn',
112 'newline-per-chained-call': 'off',
113 'no-array-constructor': 'off',
114 'no-bitwise': 'error',
115 'no-continue': 'off',
116 'no-inline-comments': 'off',
117 'no-lonely-if': 'off',
118 'no-mixed-operators': 'off',
119 'no-multiple-empty-lines': 'warn',
120 'no-negated-condition': 'off',
121 'no-nested-ternary': 'warn',
122 'no-new-object': 'off',
123 'no-plusplus': 'off',
126 'no-trailing-spaces': 'error',
127 'no-underscore-dangle': 'off',
128 'no-unneeded-ternary': 'off',
129 'no-whitespace-before-property': 'warn',
130 'object-curly-newline': 'off',
131 'object-curly-spacing': 'warn',
132 'object-property-newline': 'off',
134 'one-var-declaration-per-line': ['warn', 'initializations'],
135 'operator-assignment': 'off',
136 'operator-linebreak': 'off',
137 'padded-blocks': 'off',
138 'quote-props': ['warn', 'as-needed', {'unnecessary': false, 'keywords': true, 'numbers': true}],
141 'semi-spacing': ['warn', {'before': false, 'after': true}],
143 'space-before-blocks': 'warn',
144 'space-before-function-paren': ['warn', 'never'],
145 'space-in-parens': 'warn',
146 'space-infix-ops': 'warn',
147 'space-unary-ops': 'warn',
148 'spaced-comment': 'warn',
149 'unicode-bom': 'error',
152 // === Promises (override plugin:promise/recommended) ===
153 'promise/always-return': 'warn',
154 'promise/no-return-wrap': 'warn',
155 'promise/param-names': 'warn',
156 'promise/catch-or-return': ['warn', {terminationMethod: ['catch', 'fail']}],
157 'promise/no-native': 'warn',
158 'promise/avoid-new': 'warn',
160 // === Deprecations ===
161 "no-restricted-properties": ['warn', {
164 'message': 'Use "core/str" module or M.util.get_string()'
169 files: ["**/yui/src/**/*.js"],
171 // Disable ES6+ for YUI files.
174 // Disable some rules which we can't safely define for YUI rollups.
177 'no-unused-vars': 'off',
178 'no-unused-expressions': 'off',
181 "jsdoc/check-access": 'off',
182 "jsdoc/check-alignment": 'off',
183 "jsdoc/check-param-names": 'off',
184 "jsdoc/check-property-names": 'off',
185 "jsdoc/empty-tags": 'off',
186 "jsdoc/implements-on-classes": 'off',
187 "jsdoc/multiline-blocks": 'off',
188 "jsdoc/require-jsdoc": 'off',
189 "jsdoc/require-param": 'off',
190 "jsdoc/require-param-name": 'off',
191 "jsdoc/require-param-type": 'off',
192 "jsdoc/require-property": 'off',
193 "jsdoc/require-property-name": 'off',
194 "jsdoc/require-property-type": 'off',
198 files: ["**/amd/src/*.js", "**/amd/src/**/*.js", "Gruntfile.js", ".grunt/*.js", ".grunt/tasks/*.js", "jsdoc.conf.js"],
199 // We're using babel transpiling so use their parser
201 parser: '@babel/eslint-parser',
202 // Check AMD with some slightly stricter rules.
204 'no-implicit-globals': 'error',
205 // Disable all of the rules that have babel versions.
207 // Not using this rule for the time being because it isn't
208 // compatible with jQuery and ES6.
209 'no-invalid-this': 'off',
210 'object-curly-spacing': 'off',
213 'no-unused-expressions': 'off',
214 // Enable all of the babel version of these rules.
215 '@babel/new-cap': ['warn', { 'properties': false }],
216 // Not using this rule for the time being because it isn't
217 // compatible with jQuery and ES6.
218 '@babel/no-invalid-this': 'off',
219 '@babel/object-curly-spacing': 'warn',
220 '@babel/semi': 'error',
221 '@babel/no-unused-expressions': 'error',
223 // We have Promise now that we're using ES6.
224 'promise/no-native': 'off',
225 'promise/avoid-new': 'off',
228 'jsdoc/check-access': 'error',
229 'jsdoc/check-alignment': 1, // Recommended.
230 'jsdoc/check-param-names': 'error',
231 'jsdoc/check-property-names': 'error',
232 'jsdoc/empty-tags': 'error',
233 'jsdoc/implements-on-classes': 'error',
234 'jsdoc/multiline-blocks': 'error',
235 'jsdoc/require-jsdoc': 'error',
236 'jsdoc/require-param': 'error',
237 'jsdoc/require-param-name': 'error',
238 'jsdoc/require-param-type': 'error',
239 'jsdoc/require-property': 'error',
240 'jsdoc/require-property-name': 'error',
241 'jsdoc/require-property-type': 'error'
244 'sourceType': 'module',
245 'requireConfigFile': false