-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
147 lines (140 loc) · 4.23 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
const config = {
env: {
browser: true,
es6: true,
node: true,
},
extends: [
"eslint:recommended",
"plugin:prettier/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"prettier",
],
globals: {
ENVIRONMENT: false,
},
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: "es2022",
sourceType: "module",
},
parser: "@typescript-eslint/parser",
ignorePatterns: ["tsconfig.json", "node_modules/**/*", "dist/**/*", ".cache/**/*", "*.svg"],
rules: {
"array-callback-return": "error",
"arrow-body-style": ["error", "as-needed"],
"arrow-parens": ["error", "as-needed"],
"arrow-spacing": "error",
"dot-notation": "error",
eqeqeq: ["error", "always", { null: "ignore" }],
"no-array-constructor": "error",
"no-duplicate-imports": "error",
"no-iterator": "error",
"no-loop-func": "error",
"no-new-func": "error",
"no-new-object": "error",
"no-new-wrappers": "error",
"no-prototype-builtins": 0,
"no-redeclare": 0,
"no-underscore-dangle": "error",
"no-unneeded-ternary": "error",
"no-useless-concat": "error",
"no-useless-constructor": "error",
"no-var": "error",
"object-shorthand": "error",
"prefer-arrow-callback": "error",
"prefer-const": [
"error",
{
destructuring: "all",
ignoreReadBeforeAssign: true,
},
],
"prefer-destructuring": "error",
"prefer-rest-params": "error",
"prefer-template": "error",
"quote-props": ["error", "as-needed"],
"spaced-comment": ["error", "always", { markers: ["/"] }],
"require-atomic-updates": 0,
yoda: ["error", "never"],
"import/order": [
"error",
{
"newlines-between": "always",
groups: [
"builtin", // Built-in types are first
"external",
["sibling", "parent"], // Then sibling and parent types. They can be mingled together
"index", // Then the index file
"object",
// Then the rest: internal and external type
],
},
],
// tree shaking guard
"no-restricted-imports": [
"error",
{
paths: [
{ name: "lodash", message: "Please treeshake like 'import { get } from \"lodash/get\";'." },
{
name: "@fortawesome/pro-solid-svg-icons",
message: "Please treeshake like 'import { faTimes } from \"@fortawesome/pro-solid-svg-icons/faTimes\";'.",
},
{
name: "@fortawesome/pro-regular-svg-icons",
message: "Please treeshake like 'import { faTimes } from \"@fortawesome/pro-regular-svg-icons/faTimes\";'.",
},
{
name: "@fortawesome/free-brands-svg-icons",
message:
"Please treeshake like 'import { faTwitter } from \"@fortawesome/free-brands-svg-icons/faTwitter\";'.",
},
],
},
],
},
settings: {
"import/resolver": {
typescript: true,
node: true,
},
},
overrides: [
{
files: ["**/*.ts", "**/*.tsx"],
extends: ["plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/eslint-plugin/recommended"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
},
plugins: ["@typescript-eslint"],
rules: {
"id-denylist": ["error", "PropTypes", "propTypes", "defaultProps"],
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"@typescript-eslint/consistent-type-imports": ["error"],
// note you must disable the base rule as it can report incorrect errors
"no-useless-constructor": "off",
"@typescript-eslint/no-useless-constructor": ["error"],
"no-dupe-class-members": "off", // disable the original rule first
"@typescript-eslint/no-dupe-class-members": ["error"],
"@typescript-eslint/type-annotation-spacing": ["error"],
"@typescript-eslint/no-unnecessary-type-assertion": ["error"],
"@typescript-eslint/no-unnecessary-type-arguments": ["error"],
"@typescript-eslint/no-unnecessary-qualifier": ["error"],
"@typescript-eslint/no-unsafe-enum-comparison": ["error"],
"@typescript-eslint/await-thenable": ["error"],
// note you must disable the base rule as it can report incorrect errors
"no-duplicate-imports": "off",
},
},
],
};
module.exports = config;