Skip to content

Commit 71f44e9

Browse files
authored
fix: inline eslint-plugin-unicorn recommended rules (#423)
* fix: inline `eslint-plugin-unicorn` recommended rules * chore: fix comment
1 parent 77c07c0 commit 71f44e9

File tree

1 file changed

+90
-5
lines changed

1 file changed

+90
-5
lines changed

.eslintrc.js

Lines changed: 90 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ module.exports = {
66
requireConfigFile: false,
77
sourceType: 'script',
88
},
9-
plugins: ['markdown', 'html', 'fp'],
9+
plugins: ['markdown', 'html', 'fp', 'unicorn'],
1010
extends: [
1111
'eslint:recommended',
1212
'standard',
1313
'prettier',
1414
'plugin:eslint-comments/recommended',
15-
'plugin:unicorn/recommended',
1615
'plugin:node/recommended',
1716
'plugin:import/recommended',
1817
'plugin:promise/recommended',
@@ -78,7 +77,8 @@ module.exports = {
7877
],
7978
'no-multi-assign': 2,
8079
'no-negated-condition': 2,
81-
'no-nested-ternary': 2,
80+
// Conflicts with unicorn/no-nested-ternary
81+
'no-nested-ternary': 0,
8282
'no-nonoctal-decimal-escape': 2,
8383
'no-param-reassign': [
8484
2,
@@ -182,7 +182,7 @@ module.exports = {
182182
// TODO: remove once bug in eslint-plugin-node is fixed:
183183
// https://github.com/mysticatea/eslint-plugin-node/issues/250
184184
'node/no-unsupported-features/es-syntax': [
185-
'error',
185+
2,
186186
{
187187
ignores: ['modules', 'dynamicImport'],
188188
},
@@ -210,7 +210,6 @@ module.exports = {
210210

211211
'react/prop-types': 0,
212212

213-
// Not enabled by default in unicorn/recommended, but still pretty useful
214213
'unicorn/custom-error-definition': 2,
215214
'unicorn/no-unused-properties': 2,
216215
// The additional `non-zero` option is useful for code consistency
@@ -240,6 +239,92 @@ module.exports = {
240239
// TODO: enable those rules
241240
'unicorn/no-process-exit': 0,
242241
'unicorn/import-style': 0,
242+
// Useful rules
243+
'unicorn/catch-error-name': 2,
244+
'unicorn/consistent-destructuring': 2,
245+
'unicorn/consistent-function-scoping': 2,
246+
'unicorn/empty-brace-spaces': 2,
247+
'unicorn/error-message': 2,
248+
'unicorn/escape-case': 2,
249+
'unicorn/import-index': 0,
250+
'unicorn/new-for-builtins': 2,
251+
'unicorn/no-abusive-eslint-disable': 2,
252+
'unicorn/no-array-method-this-argument': 2,
253+
'unicorn/no-array-push-push': 2,
254+
'unicorn/no-await-expression-member': 2,
255+
'unicorn/no-console-spaces': 2,
256+
'unicorn/no-document-cookie': 2,
257+
'unicorn/no-empty-file': 2,
258+
'unicorn/no-for-loop': 2,
259+
'unicorn/no-hex-escape': 2,
260+
'unicorn/no-instanceof-array': 2,
261+
'unicorn/no-invalid-remove-event-listener': 2,
262+
'unicorn/no-keyword-prefix': 0,
263+
'unicorn/no-lonely-if': 2,
264+
'unicorn/no-nested-ternary': 2,
265+
'unicorn/no-new-array': 2,
266+
'unicorn/no-new-buffer': 2,
267+
'unicorn/no-object-as-default-parameter': 2,
268+
'unicorn/no-static-only-class': 2,
269+
'unicorn/no-thenable': 2,
270+
'unicorn/no-this-assignment': 2,
271+
'unicorn/no-unsafe-regex': 0,
272+
'unicorn/no-useless-fallback-in-spread': 2,
273+
'unicorn/no-useless-length-check': 2,
274+
'unicorn/no-useless-promise-resolve-reject': 2,
275+
'unicorn/no-useless-spread': 2,
276+
'unicorn/no-useless-undefined': 2,
277+
'unicorn/no-zero-fractions': 2,
278+
'unicorn/numeric-separators-style': 2,
279+
'unicorn/prefer-add-event-listener': 2,
280+
'unicorn/prefer-array-find': 2,
281+
'unicorn/prefer-array-flat': 2,
282+
'unicorn/prefer-array-flat-map': 2,
283+
'unicorn/prefer-array-index-of': 2,
284+
'unicorn/prefer-array-some': 2,
285+
// TODO: Enable this by default when targeting a Node.js version that supports `Array#at`.
286+
'unicorn/prefer-at': 0,
287+
'unicorn/prefer-code-point': 2,
288+
'unicorn/prefer-date-now': 2,
289+
'unicorn/prefer-default-parameters': 2,
290+
'unicorn/prefer-dom-node-append': 2,
291+
'unicorn/prefer-dom-node-dataset': 2,
292+
'unicorn/prefer-dom-node-remove': 2,
293+
'unicorn/prefer-dom-node-text-content': 2,
294+
'unicorn/prefer-export-from': 2,
295+
'unicorn/prefer-includes': 2,
296+
'unicorn/prefer-json-parse-buffer': 2,
297+
'unicorn/prefer-keyboard-event-key': 2,
298+
'unicorn/prefer-math-trunc': 2,
299+
'unicorn/prefer-modern-dom-apis': 2,
300+
'unicorn/prefer-negative-index': 2,
301+
'unicorn/prefer-number-properties': 2,
302+
'unicorn/prefer-optional-catch-binding': 2,
303+
'unicorn/prefer-prototype-methods': 2,
304+
'unicorn/prefer-query-selector': 2,
305+
'unicorn/prefer-reflect-apply': 2,
306+
'unicorn/prefer-regexp-test': 2,
307+
'unicorn/prefer-set-has': 2,
308+
'unicorn/prefer-spread': 2,
309+
// TODO: Enable this by default when targeting Node.js 16.
310+
'unicorn/prefer-string-replace-all': 0,
311+
'unicorn/prefer-string-slice': 2,
312+
'unicorn/prefer-string-starts-ends-with': 2,
313+
'unicorn/prefer-string-trim-start-end': 2,
314+
'unicorn/prefer-switch': 2,
315+
'unicorn/prefer-ternary': 2,
316+
// TODO: Enable this by default when targeting Node.js 14.
317+
'unicorn/prefer-top-level-await': 0,
318+
'unicorn/prefer-type-error': 2,
319+
'unicorn/relative-url-style': 2,
320+
'unicorn/require-array-join-separator': 2,
321+
'unicorn/require-number-to-fixed-digits-argument': 2,
322+
// Turned off because we can't distinguish `window.postMessage` and `{Worker,MessagePort,Client,BroadcastChannel}#postMessage()`
323+
// See https://github.com/sindresorhus/eslint-plugin-unicorn/issues/1396
324+
'unicorn/require-post-message-target-origin': 0,
325+
'unicorn/string-content': 0,
326+
'unicorn/template-indent': 1,
327+
'unicorn/throw-new-error': 2,
243328
},
244329
overrides: [
245330
{

0 commit comments

Comments
 (0)