Skip to content

Commit

Permalink
fix: inline eslint-plugin-unicorn recommended rules (#423)
Browse files Browse the repository at this point in the history
* fix: inline `eslint-plugin-unicorn` recommended rules

* chore: fix comment
  • Loading branch information
ehmicky authored Jan 17, 2022
1 parent 77c07c0 commit 71f44e9
Showing 1 changed file with 90 additions and 5 deletions.
95 changes: 90 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ module.exports = {
requireConfigFile: false,
sourceType: 'script',
},
plugins: ['markdown', 'html', 'fp'],
plugins: ['markdown', 'html', 'fp', 'unicorn'],
extends: [
'eslint:recommended',
'standard',
'prettier',
'plugin:eslint-comments/recommended',
'plugin:unicorn/recommended',
'plugin:node/recommended',
'plugin:import/recommended',
'plugin:promise/recommended',
Expand Down Expand Up @@ -78,7 +77,8 @@ module.exports = {
],
'no-multi-assign': 2,
'no-negated-condition': 2,
'no-nested-ternary': 2,
// Conflicts with unicorn/no-nested-ternary
'no-nested-ternary': 0,
'no-nonoctal-decimal-escape': 2,
'no-param-reassign': [
2,
Expand Down Expand Up @@ -182,7 +182,7 @@ module.exports = {
// TODO: remove once bug in eslint-plugin-node is fixed:
// https://github.com/mysticatea/eslint-plugin-node/issues/250
'node/no-unsupported-features/es-syntax': [
'error',
2,
{
ignores: ['modules', 'dynamicImport'],
},
Expand Down Expand Up @@ -210,7 +210,6 @@ module.exports = {

'react/prop-types': 0,

// Not enabled by default in unicorn/recommended, but still pretty useful
'unicorn/custom-error-definition': 2,
'unicorn/no-unused-properties': 2,
// The additional `non-zero` option is useful for code consistency
Expand Down Expand Up @@ -240,6 +239,92 @@ module.exports = {
// TODO: enable those rules
'unicorn/no-process-exit': 0,
'unicorn/import-style': 0,
// Useful rules
'unicorn/catch-error-name': 2,
'unicorn/consistent-destructuring': 2,
'unicorn/consistent-function-scoping': 2,
'unicorn/empty-brace-spaces': 2,
'unicorn/error-message': 2,
'unicorn/escape-case': 2,
'unicorn/import-index': 0,
'unicorn/new-for-builtins': 2,
'unicorn/no-abusive-eslint-disable': 2,
'unicorn/no-array-method-this-argument': 2,
'unicorn/no-array-push-push': 2,
'unicorn/no-await-expression-member': 2,
'unicorn/no-console-spaces': 2,
'unicorn/no-document-cookie': 2,
'unicorn/no-empty-file': 2,
'unicorn/no-for-loop': 2,
'unicorn/no-hex-escape': 2,
'unicorn/no-instanceof-array': 2,
'unicorn/no-invalid-remove-event-listener': 2,
'unicorn/no-keyword-prefix': 0,
'unicorn/no-lonely-if': 2,
'unicorn/no-nested-ternary': 2,
'unicorn/no-new-array': 2,
'unicorn/no-new-buffer': 2,
'unicorn/no-object-as-default-parameter': 2,
'unicorn/no-static-only-class': 2,
'unicorn/no-thenable': 2,
'unicorn/no-this-assignment': 2,
'unicorn/no-unsafe-regex': 0,
'unicorn/no-useless-fallback-in-spread': 2,
'unicorn/no-useless-length-check': 2,
'unicorn/no-useless-promise-resolve-reject': 2,
'unicorn/no-useless-spread': 2,
'unicorn/no-useless-undefined': 2,
'unicorn/no-zero-fractions': 2,
'unicorn/numeric-separators-style': 2,
'unicorn/prefer-add-event-listener': 2,
'unicorn/prefer-array-find': 2,
'unicorn/prefer-array-flat': 2,
'unicorn/prefer-array-flat-map': 2,
'unicorn/prefer-array-index-of': 2,
'unicorn/prefer-array-some': 2,
// TODO: Enable this by default when targeting a Node.js version that supports `Array#at`.
'unicorn/prefer-at': 0,
'unicorn/prefer-code-point': 2,
'unicorn/prefer-date-now': 2,
'unicorn/prefer-default-parameters': 2,
'unicorn/prefer-dom-node-append': 2,
'unicorn/prefer-dom-node-dataset': 2,
'unicorn/prefer-dom-node-remove': 2,
'unicorn/prefer-dom-node-text-content': 2,
'unicorn/prefer-export-from': 2,
'unicorn/prefer-includes': 2,
'unicorn/prefer-json-parse-buffer': 2,
'unicorn/prefer-keyboard-event-key': 2,
'unicorn/prefer-math-trunc': 2,
'unicorn/prefer-modern-dom-apis': 2,
'unicorn/prefer-negative-index': 2,
'unicorn/prefer-number-properties': 2,
'unicorn/prefer-optional-catch-binding': 2,
'unicorn/prefer-prototype-methods': 2,
'unicorn/prefer-query-selector': 2,
'unicorn/prefer-reflect-apply': 2,
'unicorn/prefer-regexp-test': 2,
'unicorn/prefer-set-has': 2,
'unicorn/prefer-spread': 2,
// TODO: Enable this by default when targeting Node.js 16.
'unicorn/prefer-string-replace-all': 0,
'unicorn/prefer-string-slice': 2,
'unicorn/prefer-string-starts-ends-with': 2,
'unicorn/prefer-string-trim-start-end': 2,
'unicorn/prefer-switch': 2,
'unicorn/prefer-ternary': 2,
// TODO: Enable this by default when targeting Node.js 14.
'unicorn/prefer-top-level-await': 0,
'unicorn/prefer-type-error': 2,
'unicorn/relative-url-style': 2,
'unicorn/require-array-join-separator': 2,
'unicorn/require-number-to-fixed-digits-argument': 2,
// Turned off because we can't distinguish `window.postMessage` and `{Worker,MessagePort,Client,BroadcastChannel}#postMessage()`
// See https://github.com/sindresorhus/eslint-plugin-unicorn/issues/1396
'unicorn/require-post-message-target-origin': 0,
'unicorn/string-content': 0,
'unicorn/template-indent': 1,
'unicorn/throw-new-error': 2,
},
overrides: [
{
Expand Down

0 comments on commit 71f44e9

Please sign in to comment.