update eslint rules

This commit is contained in:
Erik 2024-10-07 13:56:26 +03:00
parent b06e50dc08
commit 8c8677e2e5

View File

@ -1,29 +1,64 @@
{ {
// "parser": "@typescript-eslint/parser",
"plugins": [],
"env": { "env": {
"es6": true, "es6": true,
"node": true "node": true,
// "jest/globals": true
}, },
"extends": "eslint:recommended", "extends": [
"eslint:recommended",
// "plugin:@typescript-eslint/recommended"
],
"globals": { "globals": {
"Atomics": "readonly", "Atomics": "readonly",
"SharedArrayBuffer": "readonly" "SharedArrayBuffer": "readonly"
}, },
"parserOptions": { "parserOptions": {
"ecmaVersion": 2022, "ecmaVersion": 2022,
"sourceType": "module" "sourceType": "module",
// "project": "./tsconfig.json"
}, },
"rules": { "rules": {
// "@typescript-eslint/no-unused-vars": "off",
// "@typescript-eslint/no-non-null-assertion": "off",
// "@typescript-eslint/no-misused-promises": ["error", {
// "checksVoidReturn": {
// "arguments": false
// }
// }],
// "@typescript-eslint/no-shadow": "error",
// "@typescript-eslint/no-use-before-define": "error",
"accessor-pairs": "warn", "accessor-pairs": "warn",
"array-callback-return": "warn", "array-callback-return": "warn",
"array-bracket-newline": ["warn", "consistent"], "array-bracket-newline": [
"array-bracket-spacing": ["warn", "always", { "objectsInArrays": false, "arraysInArrays": false }], "warn",
"consistent"
],
"array-bracket-spacing": [
"warn",
"always",
{
"objectsInArrays": false,
"arraysInArrays": false
}
],
"arrow-spacing": "warn", "arrow-spacing": "warn",
"block-scoped-var": "warn", "block-scoped-var": "warn",
"block-spacing": ["warn", "always"], "block-spacing": [
"brace-style": ["warn", "1tbs"], "warn",
"always"
],
"brace-style": [
"warn",
"allman"
],
"callback-return": "warn", "callback-return": "warn",
"camelcase": "warn", "camelcase": "warn",
"comma-dangle": ["warn", "only-multiline"], "comma-dangle": [
"warn",
"only-multiline"
],
"comma-spacing": [ "comma-spacing": [
"warn", "warn",
{ {
@ -64,30 +99,66 @@
"id-blacklist": "warn", "id-blacklist": "warn",
"id-match": "warn", "id-match": "warn",
"implicit-arrow-linebreak": "warn", "implicit-arrow-linebreak": "warn",
"indent": "warn", "indent": [
"warn",
4,
{
"SwitchCase": 1
}
],
"init-declarations": "warn", "init-declarations": "warn",
"jsx-quotes": ["warn", "prefer-single"], "quotes": [
"key-spacing": ["warn", { "beforeColon": false, "afterColon": true }], "error",
"keyword-spacing": ["warn", { "after": true, "before": true }], "single"
],
"jsx-quotes": [
"warn",
"prefer-single"
],
"key-spacing": [
"warn",
{
"beforeColon": false,
"afterColon": true
}
],
"keyword-spacing": [
"warn",
{
"after": true,
"before": true
}
],
"linebreak-style": [ "linebreak-style": [
"error", "error",
"windows" "unix"
], ],
"lines-around-comment": "warn", "lines-around-comment": "warn",
"lines-around-directive": "warn", "lines-around-directive": "warn",
"max-classes-per-file": "warn", "max-classes-per-file": "warn",
"max-nested-callbacks": "warn", "max-nested-callbacks": "warn",
"max-len": ["warn", { "max-len": [
"warn",
{
"code": 140, "code": 140,
"ignoreComments": true, "ignoreComments": true,
"ignoreStrings": true, "ignoreStrings": true,
"ignoreTemplateLiterals": true, "ignoreTemplateLiterals": true,
"ignoreRegExpLiterals": true "ignoreRegExpLiterals": true
}], }
],
"max-lines-per-function": [
"warn",
140
],
"max-depth": [
"warn",
3
],
"new-parens": "warn", "new-parens": "warn",
"no-alert": "warn", "no-alert": "warn",
"no-array-constructor": "warn", "no-array-constructor": "warn",
"no-bitwise": "warn", // "no-bitwise": "warn",
"no-buffer-constructor": "warn", "no-buffer-constructor": "warn",
"no-caller": "warn", "no-caller": "warn",
"no-console": "warn", "no-console": "warn",
@ -102,7 +173,6 @@
"no-extend-native": "warn", "no-extend-native": "warn",
"no-extra-bind": "warn", "no-extra-bind": "warn",
"no-extra-label": "warn", "no-extra-label": "warn",
"no-extra-parens": "warn",
"no-floating-decimal": "warn", "no-floating-decimal": "warn",
"no-implicit-coercion": "warn", "no-implicit-coercion": "warn",
"no-implicit-globals": "warn", "no-implicit-globals": "warn",
@ -137,23 +207,25 @@
"no-restricted-modules": "warn", "no-restricted-modules": "warn",
"no-restricted-properties": "warn", "no-restricted-properties": "warn",
"no-restricted-syntax": "warn", "no-restricted-syntax": "warn",
"no-return-assign": "warn", "no-return-assign": [
"warn",
"except-parens"
],
"no-return-await": "warn", "no-return-await": "warn",
"no-script-url": "warn", "no-script-url": "warn",
"no-self-compare": "warn", "no-self-compare": "warn",
"no-sequences": "warn", "no-sequences": "warn",
"no-setter-return": "warn", "no-setter-return": "warn",
"no-spaced-func": "warn", "no-spaced-func": "warn",
"no-shadow": "error",
"no-tabs": "warn", "no-tabs": "warn",
"no-template-curly-in-string": "error", "no-template-curly-in-string": "error",
"no-throw-literal": "warn", "no-throw-literal": "warn",
"no-trailing-spaces": "warn",
"no-undef-init": "error", "no-undef-init": "error",
"no-undefined": "error", "no-undefined": "error",
"no-unmodified-loop-condition": "warn", "no-unmodified-loop-condition": "warn",
"no-unneeded-ternary": "error", "no-unneeded-ternary": "error",
"no-unused-expressions": "warn", "no-unused-expressions": "warn",
"no-use-before-define": "error",
"no-useless-call": "warn", "no-useless-call": "warn",
"no-useless-computed-key": "warn", "no-useless-computed-key": "warn",
"no-useless-concat": "warn", "no-useless-concat": "warn",
@ -161,20 +233,38 @@
"no-useless-rename": "warn", "no-useless-rename": "warn",
"no-useless-return": "warn", "no-useless-return": "warn",
"no-var": "warn", "no-var": "warn",
"no-void": "warn", // "no-void": "warn",
"no-whitespace-before-property": "error", "no-whitespace-before-property": "error",
"nonblock-statement-body-position": ["warn", "below"], "nonblock-statement-body-position": [
"warn",
"below"
],
"object-curly-spacing": [ "object-curly-spacing": [
"warn", "warn",
"always" "always"
], ],
"object-property-newline": ["warn", { "allowAllPropertiesOnSameLine": true }], "object-property-newline": [
"warn",
{
"allowAllPropertiesOnSameLine": true
}
],
"object-shorthand": "warn", "object-shorthand": "warn",
"one-var-declaration-per-line": "warn", "one-var-declaration-per-line": "warn",
"operator-assignment": "warn", "operator-assignment": "warn",
"operator-linebreak": ["warn", "before"], "operator-linebreak": [
"padding-line-between-statements": "warn", "warn",
"padded-blocks": ["warn", { "switches": "never" }, { "allowSingleLineBlocks": true }], "before"
],
"padded-blocks": [
"warn",
{
"switches": "never"
},
{
"allowSingleLineBlocks": true
}
],
"prefer-arrow-callback": "warn", "prefer-arrow-callback": "warn",
"prefer-const": "warn", "prefer-const": "warn",
"prefer-destructuring": "warn", "prefer-destructuring": "warn",
@ -195,12 +285,18 @@
"last" "last"
], ],
"space-before-blocks": "warn", "space-before-blocks": "warn",
"space-before-function-paren":["error", "always"], "space-before-function-paren": [
"error",
"always"
],
"space-in-parens": [ "space-in-parens": [
"warn", "warn",
"never" "never"
], ],
"spaced-comment": ["warn", "always"], "spaced-comment": [
"warn",
"always"
],
"strict": "warn", "strict": "warn",
"switch-colon-spacing": "warn", "switch-colon-spacing": "warn",
"symbol-description": "warn", "symbol-description": "warn",
@ -220,6 +316,16 @@
"yoda": [ "yoda": [
"warn", "warn",
"never" "never"
],
"no-warning-comments": [
1,
{
"terms": [
"todo",
"fixme"
],
"location": "anywhere"
}
] ]
} }
} }