-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy patheslint.config.mjs
156 lines (153 loc) · 5.19 KB
/
eslint.config.mjs
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
148
149
150
151
152
153
154
155
156
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import stylistic from "@stylistic/eslint-plugin";
import eslintConfigPrettier from "eslint-config-prettier";
import eslintPluginImport from "eslint-plugin-import";
import eslintPluginReact from "eslint-plugin-react";
import eslintPluginReactHooks from "eslint-plugin-react-hooks";
import eslintPluginFlowtype from "eslint-plugin-flowtype";
import { fixupPluginRules } from "@eslint/compat";
// const __filename = fileURLToPath(import.meta.url);
// const __dirname = path.dirname(__filename);
//
// const compat = new FlatCompat({
// baseDirectory: __dirname,
// });
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.stylisticTypeChecked,
eslintConfigPrettier,
{
ignores: [
"dist",
"**/*.d.ts",
"eslint.config.mjs",
"rollup.config.mjs",
"index.{js,ts}",
],
},
{
languageOptions: {
parser: tseslint.parser,
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
ecmaFeatures: {
jsx: true,
},
},
},
settings: {
react: {
version: "17.0.0",
},
flowtype: {
onlyFilesWithFlowAnnotation: true,
},
},
plugins: {
"@typescript-eslint": tseslint.plugin,
import: eslintPluginImport,
react: eslintPluginReact,
"react-hooks": fixupPluginRules(eslintPluginReactHooks),
"@stylistic": stylistic,
flowtype: eslintPluginFlowtype,
},
rules: {
...eslintPluginReactHooks.configs.recommended.rules,
"@typescript-eslint/comma-dangle": "off",
"@typescript-eslint/no-unused-expressions": [
"error",
{
allowShortCircuit: true,
allowTernary: true,
},
],
"@typescript-eslint/no-shadow": [
"error",
{
ignoreFunctionTypeParameterNameValueShadow: true,
},
],
"@typescript-eslint/object-curly-spacing": "off",
// We need to use any for interfaces towards bpmn-js way too often for this rule to be effective
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@stylistic/lines-between-class-members": [
"error",
"always",
{
exceptAfterSingleLine: true,
},
],
"@stylistic/arrow-parens": ["error", "as-needed"],
"react/jsx-indent": [
"error",
4,
{
indentLogicalExpressions: true,
checkAttributes: true,
},
],
"react/jsx-indent-props": ["error", 4],
"react/jsx-closing-bracket-location": [
"error",
{
nonEmpty: "tag-aligned",
selfClosing: "tag-aligned",
},
],
// Does not work with TS and arrow functions
// https://github.com/yannickcr/eslint-plugin-react/issues/2353
"react/prop-types": "off",
// Is this the way to go? I think both ways are acceptable, but should not be enforced...
"react/destructuring-assignment": "off",
// We don't use default props
"react/require-default-props": "off",
"react/jsx-props-no-spreading": "off",
"flowtype/define-flow-type": "off",
"flowtype/use-flow-type": "off",
// Deprecated rule
"object-shorthand": ["error", "consistent-as-needed"],
"no-param-reassign": [
"error",
{
props: false,
},
],
radix: ["error", "as-needed"],
"object-curly-newline": [
"error",
{
ImportDeclaration: {
multiline: true,
},
},
],
"no-restricted-syntax": [
"error",
"ForInStatement",
"LabeledStatement",
"WithStatement",
],
"no-spaced-func": "off",
"import/extensions": [
"error",
"ignorePackages",
{
"": "never",
js: "never",
jsx: "never",
ts: "never",
tsx: "never",
},
],
"import/no-amd": "off",
},
},
);