-
Notifications
You must be signed in to change notification settings - Fork 4
/
.eslintrc.js
131 lines (125 loc) · 4.19 KB
/
.eslintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
module.exports = {
env: {
es6: true,
browser: true,
},
ignorePatterns: [
"**/dist/",
"**/htmlcov/**",
"**/node_modules/",
"*.config.js",
"*.json",
"*.lock",
".eslintrc.js",
".venv/",
"build/",
"docs/",
"package.json",
"package-lock.json",
],
extends: [
"airbnb",
"airbnb/hooks",
"eslint-config-preact",
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript",
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 6,
sourceType: "module",
project: "./tsconfig.json",
ecmaFeatures: {
jsx: true,
},
},
plugins: ["@typescript-eslint", "prefer-arrow", "prettier"],
rules: {
// leave these to prettier
"comma-dangle": "off",
"implicit-arrow-linebreak": "off",
"max-len": "off",
"no-confusing-arrow": "off",
"no-console": "off",
"no-multiple-empty-lines": "off",
"object-curly-newline": "off",
"operator-linebreak": "off",
"quote-props": "off",
"react/jsx-closing-bracket-location": "off",
"react/jsx-curly-newline": "off",
"react/jsx-indent": "off",
"react/jsx-indent-props": "off",
"react/jsx-one-expression-per-line": "off",
"wrap-iife": "off",
// overly strict rules
"@typescript-eslint/strict-boolean-expressions": "off",
"function-paren-newline": "off",
"no-restricted-syntax": "off",
"react/jsx-props-no-spreading": "off",
"react/no-unknown-property": "off",
// unwanted
"import/extensions": "off",
"import/no-extraneous-dependencies": "off",
"import/prefer-default-export": "off",
"indent": "off",
"lines-between-class-members": "off",
"react/jsx-filename-extension": "off",
"react/jsx-fragments": "off",
"react/require-default-props": "off",
// better @typescript-eslint rules are available
"default-case": "off", // => @typescript-eslint/switch-exhaustiveness-check
"no-unused-vars": "off", // => @typescript-eslint/no-unused-vars
"no-use-before-define": "off", // => @typescript-eslint/no-use-before-define
// project-specific (typescript)
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"@typescript-eslint/no-empty-function": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "_(unused)?",
varsIgnorePattern: "_(unused)?",
ignoreRestSiblings: true,
},
],
"@typescript-eslint/no-use-before-define": "error",
"@typescript-eslint/prefer-ts-expect-error": "error",
"@typescript-eslint/switch-exhaustiveness-check": "error",
// project-specific (general)
"curly": ["error", "all"],
"func-names": "error",
"no-magic-numbers": [
"error",
{
ignore: [-1, 0, 1, 2, 100],
ignoreArrayIndexes: true,
},
],
"no-mixed-operators": "error",
"no-plusplus": ["error", { allowForLoopAfterthoughts: true }],
"prefer-destructuring": ["error", { array: false }],
"prefer-arrow/prefer-arrow-functions": "error",
"prefer-object-spread": "error",
"prefer-template": "error",
"react/function-component-definition": ["error", { namedComponents: "arrow-function" }],
"react-hooks/exhaustive-deps": "error",
"vars-on-top": "error",
},
overrides: [
{
files: ["*.js"],
rules: {
"global-require": "off",
},
},
// officially recommended by TypeScript ESLint:
// https://typescript-eslint.io/docs/linting/troubleshooting/
{
files: ["*.ts", "*.mts", "*.cts", "*.tsx"],
rules: {
"no-undef": "off",
},
},
],
};