Last active
November 1, 2021 18:06
-
-
Save Dema/6d4192376d33afdc004f3254911c0bad to your computer and use it in GitHub Desktop.
My .eslintrc.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// eslint-disable-next-line eslint-comments/disable-enable-pair | |
/* eslint-disable unicorn/prefer-module */ | |
module.exports = { | |
extends: [ | |
"eslint:recommended", | |
"plugin:eslint-comments/recommended", | |
"plugin:import/errors", | |
"plugin:import/warnings", | |
"plugin:jest/recommended", | |
"plugin:jsx-a11y/recommended", | |
"plugin:unicorn/recommended", | |
// "optimize-regex/recommended", | |
"plugin:sonarjs/recommended", | |
"plugin:effector/recommended", | |
// "adjunct", | |
"react-app", | |
], | |
overrides: [ | |
{ | |
files: [".eslintrc.js"], | |
rules: { | |
"sort-keys-fix/sort-keys-fix": "warn", | |
}, | |
}, | |
{ | |
extends: [ | |
"plugin:import/typescript", | |
"plugin:@typescript-eslint/eslint-recommended", | |
"plugin:@typescript-eslint/recommended", | |
"plugin:@typescript-eslint/recommended-requiring-type-checking", | |
], | |
files: ["src/**/*.{ts,tsx}"], | |
rules: { | |
"@typescrip@typescript-eslint/no-var-requirest-eslint/no-explicit-any": | |
"off", | |
"@typescript-eslint/array-type": [ | |
"warn", | |
{ | |
default: "array-simple", | |
}, | |
], | |
"@typescript-eslint/await-thenable": "warn", | |
"@typescript-eslint/ban-ts-comment": "off", | |
"@typescript-eslint/ban-ts-ignore": "off", | |
"@typescript-eslint/ban-types": "warn", | |
"@typescript-eslint/consistent-type-assertions": "off", | |
"@typescript-eslint/explicit-function-return-type": "off", | |
"@typescript-eslint/explicit-module-boundary-types": "off", | |
"@typescript-eslint/indent": "off", | |
"@typescript-eslint/no-confusing-void-expression": [ | |
"error", | |
{ ignoreArrowShorthand: true }, | |
], | |
"@typescript-eslint/no-empty-function": "off", | |
"@typescript-eslint/no-explicit-any": "off", | |
"@typescript-eslint/no-floating-promises": "warn", | |
"@typescript-eslint/no-misused-promises": "warn", | |
"@typescript-eslint/no-non-null-asserted-optional-chain": "error", | |
"@typescript-eslint/no-non-null-assertion": "off", | |
"@typescript-eslint/no-unnecessary-condition": "warn", | |
"@typescript-eslint/no-unnecessary-type-assertion": | |
"off" /* Очень много false positive на nullable поля */, | |
"@typescript-eslint/no-unsafe-assignment": "off", | |
"@typescript-eslint/no-unsafe-call": "off", | |
"@typescript-eslint/no-unsafe-member-access": "off", | |
"@typescript-eslint/no-unsafe-return": "off", | |
"@typescript-eslint/no-var-requires": "off", | |
"@typescript-eslint/prefer-literal-enum-member": "warn", | |
"@typescript-eslint/prefer-nullish-coalescing": "warn", | |
"@typescript-eslint/prefer-optional-chain": "warn", | |
"@typescript-eslint/prefer-reduce-type-parameter": "warn", | |
"@typescript-eslint/prefer-ts-expect-error": "warn", | |
"@typescript-eslint/require-array-sort-compare": "warn", | |
// "@typescript-eslint/sort-type-union-intersection-members": "warn", | |
"@typescript-eslint/restrict-plus-operands": "off", | |
"@typescript-eslint/restrict-template-expressions": "off", | |
"@typescript-eslint/switch-exhaustiveness-check": "warn", | |
"@typescript-eslint/unbound-method": "off", | |
"deprecation/deprecation": "warn", | |
"no-void": [ | |
"warn", | |
{ | |
allowAsStatement: true, | |
}, | |
], | |
}, | |
}, | |
], | |
parserOptions: { | |
project: "./tsconfig.json", | |
}, | |
plugins: [ | |
"sort-keys-fix", | |
"@typescript-eslint", | |
"deprecate", | |
"deprecation", | |
"eslint-comments", | |
"github", | |
"jsx-a11y", | |
"postcss-modules", | |
"prettier", | |
"react-hooks", | |
"sonarjs", | |
"sort-imports-es6-autofix", | |
"optimize-regex", | |
"unicorn", | |
"effector", | |
"react-memo", | |
//"local", | |
], | |
rules: { | |
"arrow-body-style": ["warn"], | |
"consistent-return": "error", | |
curly: ["warn", "all"], | |
"deprecate/import": "warn", | |
"deprecate/member-expression": [ | |
"warn", | |
{ | |
name: "React.useEffect", | |
use: 'import { useEffect } from "react";', | |
}, | |
{ | |
name: "React.useState", | |
use: 'import { useState } from "react";', | |
}, | |
{ | |
name: "React.useRef", | |
use: 'import { useRef } from "react";', | |
}, | |
{ | |
name: "React.useReducer", | |
use: 'import { useReducer } from "react";', | |
}, | |
{ | |
name: "React.useContext", | |
use: 'import { useContext } from "react";', | |
}, | |
], | |
eqeqeq: ["error", "smart"], | |
"eslint-comments/disable-enable-pair": "off", | |
"import/named": "off", | |
"import/namespace": "off", | |
"import/no-deprecated": "warn", | |
"import/no-named-as-default": "off", | |
"import/no-useless-path-segments": "warn", | |
"import/prefer-default-export": "off", | |
"jsx-a11y/anchor-has-content": "off", | |
"jsx-a11y/anchor-is-valid": "off", | |
"jsx-a11y/click-events-have-key-events": "off", | |
"jsx-a11y/label-has-associated-control": "off", | |
"jsx-a11y/no-autofocus": "off", | |
"no-alert": ["error"], | |
"no-await-in-loop": "warn", | |
"no-console": "warn", | |
"no-constant-condition": "warn", | |
"no-debugger": "warn", | |
"no-empty-pattern": "warn", | |
"no-extend-native": ["error"], | |
"no-implicit-coercion": ["error", { disallowTemplateShorthand: true }], | |
"no-lonely-if": ["warn"], | |
"no-negated-condition": ["warn"], | |
"no-return-assign": "error", | |
"no-return-await": "error", | |
"no-sequences": "error", | |
"no-undef": ["warn", { typeof: true }], | |
"no-unused-expressions": [ | |
"warn", | |
{ | |
allowShortCircuit: true, | |
allowTaggedTemplates: true, | |
allowTernary: true, | |
}, | |
], | |
"no-unused-labels": "warn", | |
"no-useless-computed-key": "warn", | |
"no-useless-concat": "warn", | |
"no-useless-constructor": "warn", | |
"no-useless-escape": "warn", | |
"no-useless-rename": [ | |
"warn", | |
{ ignoreDestructuring: false, ignoreExport: false, ignoreImport: false }, | |
], | |
"no-var": "error", | |
"no-void": "warn", | |
"object-shorthand": "warn", | |
"optimize-regex/optimize-regex": [ | |
"warn", | |
{ blacklist: ["charClassClassrangesMerge"] }, | |
], | |
"prefer-const": "warn", | |
"prefer-template": "warn", | |
"react-hooks/exhaustive-deps": [ | |
"error", | |
{ enableDangerousAutofixThisMayCauseInfiniteLoops: true }, | |
], | |
"react-hooks/rules-of-hooks": "error", | |
"react-memo/require-memo": "warn", | |
"react-memo/require-usememo": "warn", | |
"react/button-has-type": "error", | |
"react/display-name": "off", | |
"react/jsx-boolean-value": ["warn", "never"], | |
"react/jsx-handler-names": "warn", | |
"react/jsx-key": "warn", | |
"react/jsx-no-comment-textnodes": "warn", | |
"react/jsx-no-duplicate-props": ["warn", { ignoreCase: true }], | |
"react/jsx-no-target-blank": "warn", | |
"react/jsx-no-undef": "error", | |
"react/jsx-pascal-case": ["warn", { allowAllCaps: true, ignore: [] }], | |
"react/jsx-sort-props": [ | |
"warn", | |
{ callbacksLast: false, reservedFirst: true, shorthandFirst: true }, | |
], | |
"react/jsx-uses-react": "warn", | |
"react/jsx-uses-vars": "warn", | |
"react/no-access-state-in-setstate": "error", | |
"react/no-children-prop": "warn", | |
"react/no-danger-with-children": "error", | |
"react/no-deprecated": "warn", | |
"react/no-direct-mutation-state": "error", | |
"react/no-is-mounted": "warn", | |
"react/no-this-in-sfc": "error", | |
"react/no-unescaped-entities": "off", | |
"react/no-unknown-property": "warn", | |
"react/no-unused-prop-types": "warn", | |
"react/no-unused-state": "warn", | |
"react/react-in-jsx-scope": "error", | |
"react/require-render-return": "error", | |
"react/style-prop-object": "warn", | |
"require-atomic-updates": ["error"], | |
"require-await": "error", | |
"sonarjs/cognitive-complexity": "warn", | |
"sonarjs/no-duplicate-string": "off", | |
"sort-imports-es6-autofix/sort-imports-es6": [ | |
"warn", | |
{ | |
ignoreCase: false, | |
ignoreMemberSort: false, | |
memberSyntaxSortOrder: ["none", "all", "multiple", "single"], | |
}, | |
], | |
"unicorn/consistent-function-scoping": "warn", | |
"unicorn/no-array-callback-reference": "off", | |
"unicorn/no-nested-ternary": "off", | |
"unicorn/no-null": "off", | |
"unicorn/no-useless-undefined": "off", | |
"unicorn/number-literal-case": "off", | |
"unicorn/prefer-ternary": "off", | |
"unicorn/prevent-abbreviations": "off", | |
"valid-typeof": ["error", { requireStringLiterals: true }], | |
yoda: "error", | |
}, | |
settings: { | |
"postcss-modules": { | |
baseDir: "cwd", | |
camelCase: true, | |
defaultScope: "local", | |
exclude: /\/node_modules\//, | |
include: /\.css$/, | |
postcssConfigDir: "cwd", | |
}, | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment