Skip to content

Commit

Permalink
feat: migrate eslint config eslint/all into dedicated rules for bette…
Browse files Browse the repository at this point in the history
…r semver support (#30)
  • Loading branch information
CatchMe2 authored Mar 30, 2023
1 parent 818fb54 commit 000db1e
Show file tree
Hide file tree
Showing 2 changed files with 209 additions and 31 deletions.
236 changes: 207 additions & 29 deletions configs/eslint.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,217 @@
module.exports = {
extends: ['eslint:all', 'prettier'],
rules: {
'one-var': ['error', 'never'],
'no-magic-numbers': 'off',
'sort-keys': 'off',
'sort-imports': 'off',
// https://eslint.org/docs/latest/rules

// Possible Problems
'array-callback-return': 'error',
'constructor-super': 'error',
'for-direction': 'error',
'getter-return': 'error',
'no-async-promise-executor': 'error',
'no-await-in-loop': 'error',
'no-class-assign': 'error',
'no-compare-neg-zero': 'error',
'no-cond-assign': 'error',
'no-const-assign': 'error',
'no-constant-binary-expression': 'error',
'no-constant-condition': 'error',
'no-constructor-return': 'error',
'no-control-regex': 'error',
'no-debugger': 'error',
'no-dupe-args': 'error',
'no-dupe-class-members': 'error',
'no-dupe-else-if': 'error',
'no-dupe-keys': 'error',
'no-duplicate-case': 'error',
'no-duplicate-imports': 'error',
'no-empty-character-class': 'error',
'no-empty-pattern': 'error',
'no-ex-assign': 'error',
'no-fallthrough': 'error',
'no-func-assign': 'error',
'no-import-assign': 'error',
'no-inner-declarations': 'error',
'no-invalid-regexp': 'error',
'no-irregular-whitespace': 'error',
'no-loss-of-precision': 'error',
'no-misleading-character-class': 'error',
'no-new-native-nonconstructor': 'error',
'no-new-symbol': 'error',
'no-obj-calls': 'error',
'no-promise-executor-return': 'error',
'no-prototype-builtins': 'error',
'no-self-assign': 'error',
'no-self-compare': 'error',
'no-setter-return': 'error',
'no-sparse-arrays': 'error',
'no-template-curly-in-string': 'error',
'no-this-before-super': 'error',
'no-undef': 'error',
'no-unexpected-multiline': 'off', // conflicts with prettier
'no-unmodified-loop-condition': 'error',
'no-unreachable': 'error',
'no-unreachable-loop': 'error',
'no-unsafe-finally': 'error',
'no-unsafe-negation': 'error',
'no-unsafe-optional-chaining': 'error',
'no-unused-private-class-members': 'error',
'no-unused-vars': 'error',
'no-use-before-define': 'error',
'no-useless-backreference': 'error',
'require-atomic-updates': 'error',
'use-isnan': 'error',
'valid-typeof': 'error',

// Suggestions
'accessor-pairs': 'error',
'arrow-body-style': 'off',
'block-scoped-var': 'error',
camelcase: 'off',
'capitalized-comments': 'off',
'class-methods-use-this': 'off',
complexity: 'error',
'consistent-return': 'off',
'consistent-this': 'error',
curly: ['error', 'all'],
'default-case': 'error',
'default-case-last': 'error',
'default-param-last': 'error',
'dot-notation': 'error',
eqeqeq: 'error',
'func-name-matching': 'error',
'func-names': 'error',
'func-style': 'error',
'grouped-accessor-pairs': 'error',
'guard-for-in': 'error',
'id-denylist': 'error',
'id-length': 'off',
'id-match': 'error',
'init-declarations': 'off',
'logical-assignment-operators': 'error',
'max-classes-per-file': 'off',
'max-depth': 'error',
'max-lines': 'off',
'max-lines-per-function': 'off',
'max-nested-callbacks': 'error',
'max-params': 'error',
'max-statements': 'off',
'max-lines': 'off',
'max-params': 'off',
'max-classes-per-file': 'off',
'id-length': 'off',
'no-warning-comments': 'off',
'no-ternary': 'off',
'multiline-comment-style': 'off',
'new-cap': 'off',
'no-alert': 'error',
'no-array-constructor': 'error',
'no-bitwise': 'error',
'no-caller': 'error',
'no-case-declarations': 'error',
'no-confusing-arrow': 'off', // conflicts with prettier
'no-console': 'error',
'no-continue': 'off',
'no-undefined': 'off',
'no-await-in-loop': 'off',
'no-delete-var': 'error',
'no-div-regex': 'error',
'no-else-return': 'error',
'no-empty': 'error',
'no-empty-function': ['error', { allow: ['arrowFunctions'] }],
'no-empty-static-block': 'error',
'no-eq-null': 'error',
'no-eval': 'error',
'no-extend-native': 'error',
'no-extra-bind': 'error',
'no-extra-boolean-cast': 'error',
'no-extra-label': 'error',
'no-extra-semi': 'off', // conflicts with prettier
'no-floating-decimal': 'off', // conflicts with prettier
'no-global-assign': 'error',
'no-implicit-coercion': 'error',
'no-implicit-globals': 'error',
'no-implied-eval': 'error',
'no-inline-comments': 'off',
'no-invalid-this': 'error',
'no-iterator': 'error',
'no-label-var': 'error',
'no-labels': 'error',
'no-lone-blocks': 'error',
'no-lonely-if': 'error',
'no-loop-func': 'error',
'no-magic-numbers': 'off', // not sure about it
'no-mixed-operators': 'off', // conflicts with prettier
'no-multi-assign': 'error',
'no-multi-str': 'error',
'no-negated-condition': 'error',
'no-nested-ternary': 'error',
'no-new': 'error',
'no-new-func': 'error',
'no-new-object': 'error',
'no-new-wrappers': 'error',
'no-nonoctal-decimal-escape': 'error',
'no-octal': 'error',
'no-octal-escape': 'error',
'no-param-reassign': 'error',
'no-plusplus': 'off',
'no-proto': 'error',
'no-redeclare': 'error',
'no-regex-spaces': 'error',
'no-restricted-exports': 'error',
'no-restricted-globals': 'error',
'no-restricted-imports': 'error',
'no-restricted-properties': 'error',
'no-restricted-syntax': 'error',
'no-return-assign': 'error',
'no-return-await': 'error',
'no-script-url': 'error',
'no-sequences': 'error',
'no-shadow': 'off',
'no-shadow-restricted-names': 'error',
'no-ternary': 'off',
'no-throw-literal': 'error',
'no-undef-init': 'error',
'no-undefined': 'off',
'no-underscore-dangle': 'error',
'no-unneeded-ternary': 'error',
'no-unused-expressions': 'error',
'no-unused-labels': 'error',
'no-useless-call': 'error',
'no-useless-catch': 'error',
'no-useless-computed-key': 'error',
'no-useless-concat': 'error',
'no-useless-constructor': 'off',
'new-cap': 'off',
camelcase: 'off',
'capitalized-comments': 'off',
'lines-between-class-members': 'off',
'require-unicode-regexp': 'off',
'init-declarations': 'off',
'multiline-comment-style': 'off',
'consistent-return': 'off',
'no-useless-escape': 'error',
'no-useless-rename': 'error',
'no-useless-return': 'error',
'no-var': 'error',
'no-void': 'error',
'no-warning-comments': 'off',
'no-with': 'error',
'object-shorthand': 'error',
'one-var': ['error', 'never'],
'one-var-declaration-per-line': 'off', // conflicts with prettier
'operator-assignment': 'error',
'prefer-arrow-callback': 'error',
'prefer-const': 'error',
'prefer-destructuring': 'error',
'prefer-exponentiation-operator': 'error',
'prefer-named-capture-group': 'off',
'class-methods-use-this': 'off',
'no-shadow': 'off',
'no-empty-function': [
'error',
{
allow: ['arrowFunctions'],
},
],
'prefer-numeric-literals': 'error',
'prefer-object-has-own': 'error',
'prefer-object-spread': 'error',
'prefer-promise-reject-errors': 'error',
'prefer-regex-literals': 'error',
'prefer-rest-params': 'error',
'prefer-spread': 'error',
'prefer-template': 'error',
'quote-props': 'off', // conflicts with prettier
radix: 'error',
'require-await': 'error',
'require-unicode-regexp': 'off', // not sure about it
'require-yield': 'error',
'sort-imports': 'off',
'sort-keys': 'off',
'sort-vars': 'off',
'spaced-comment': 'error',
strict: 'error',
'symbol-description': 'error',
'vars-on-top': 'error',
yoda: 'error',

// Layout & formatting
// it should be handled by prettier
},
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.9.0",
"description": "ESLint's configuration of Mobile Reality Team",
"engines": {
"node": "^16.13 || ^18.15.0"
"node": "^16.13.0 || ^18.15.0"
},
"repository": "https://github.com/MobileReality/eslint-config",
"author": "Mobile Reality <biuro@mobilereality.pl> (https://mobilereality.pl)",
Expand Down Expand Up @@ -55,7 +55,7 @@
"peerDependencies": {
"@typescript-eslint/eslint-plugin": "~5.31.0",
"@typescript-eslint/parser": "~5.31.0",
"eslint": "~8.20.0",
"eslint": "^8.37.0",
"eslint-plugin-jest": "^26.1.5",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-prettier": "^4.2.0",
Expand Down

0 comments on commit 000db1e

Please # to comment.