Skip to content

Commit 3995646

Browse files
committed
.eslintrc.js: fix configuration, add more rules, fix lint errors
1 parent 1563d72 commit 3995646

File tree

7 files changed

+756
-163
lines changed

7 files changed

+756
-163
lines changed

.eslintrc.js

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,74 @@
11
// Copyright 2022 MFB Technologies, Inc.
22

33
module.exports = {
4+
settings: {
5+
react: {
6+
version: "detect"
7+
}
8+
},
9+
parser: "@typescript-eslint/parser",
10+
parserOptions: {
11+
ecmaVersion: "latest",
12+
sourceType: "module",
13+
ecmaFeatures: {
14+
jsx: true
15+
},
16+
project: ["./tsconfig.json"]
17+
},
18+
env: {
19+
es6: true,
20+
browser: true,
21+
node: true
22+
},
23+
ignorePatterns: ".eslintrc.js",
424
extends: [
5-
"react-app"
25+
"plugin:react/recommended",
26+
"plugin:react-hooks/recommended",
27+
"plugin:@typescript-eslint/recommended-type-checked",
28+
"plugin:react/jsx-runtime"
629
],
730
overrides: [
831
{
9-
files: ["**/*.ts?(x)"],
32+
files: ["*.ts", "*.tsx"],
1033
rules: {
34+
"no-void": [1, { allowAsStatement: true }],
1135
"@typescript-eslint/no-explicit-any": 0,
1236
"@typescript-eslint/consistent-type-definitions": [1, "type"],
1337
"@typescript-eslint/typedef": 0,
38+
"@typescript-eslint/naming-convention": [
39+
"error",
40+
{
41+
selector: "parameter",
42+
format: ["camelCase"],
43+
leadingUnderscore: "allow"
44+
}
45+
],
46+
"@typescript-eslint/no-floating-promises": [
47+
1,
48+
{
49+
ignoreVoid: true
50+
}
51+
],
52+
"react-hooks/rules-of-hooks": "error",
53+
"react-hooks/exhaustive-deps": "warn",
54+
"react/forbid-foreign-prop-types": ["warn", { allowInPropTypes: true }],
55+
"react/jsx-no-comment-textnodes": "warn",
56+
"react/jsx-no-duplicate-props": "warn",
57+
"react/jsx-no-target-blank": "warn",
58+
"react/jsx-no-undef": "error",
59+
"react/jsx-pascal-case": [
60+
"warn",
61+
{
62+
allowAllCaps: true,
63+
ignore: []
64+
}
65+
],
66+
"react/no-danger-with-children": "warn",
67+
"react/no-direct-mutation-state": "warn",
68+
"react/no-is-mounted": "warn",
69+
"react/no-typos": "error",
70+
"react/require-render-return": "error",
71+
"react/style-prop-object": "warn"
1472
}
1573
}
1674
]

0 commit comments

Comments
 (0)