-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path.eslintrc.js
146 lines (146 loc) · 6.77 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
module.exports = {
env: {
browser: true,
es2021: true,
},
plugins: ["react", "unused-imports", "sonarjs", "unicorn", "prefer-arrow", "promise"],
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:prettier/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript",
"plugin:storybook/recommended",
"standard-with-typescript",
"prettier",
"plugin:sonarjs/recommended",
],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
parser: "@typescript-eslint/parser",
project: "./tsconfig.eslint.json",
},
rules: {
"@typescript-eslint/ban-ts-comment": "error",
"@typescript-eslint/ban-types": "error",
"@typescript-eslint/explicit-module-boundary-types": "error",
"@typescript-eslint/no-empty-function": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/no-unnecessary-condition": "error",
"@typescript-eslint/no-unsafe-argument": "error",
"@typescript-eslint/no-unsafe-assignment": "error",
"@typescript-eslint/no-unsafe-call": "error",
"@typescript-eslint/no-unsafe-member-access": "error",
"@typescript-eslint/no-unsafe-return": "error",
"@typescript-eslint/no-unused-expressions": "error",
"@typescript-eslint/no-unused-vars": ["error", { varsIgnorePattern: "_" }],
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-regexp-exec": "error",
"@typescript-eslint/prefer-nullish-coalescing": ["error", { ignoreTernaryTests: false }],
"@typescript-eslint/prefer-ts-expect-error": "off",
"@typescript-eslint/restrict-plus-operands": "error",
"@typescript-eslint/restrict-template-expressions": "error",
"arrow-body-style": ["error", "as-needed"],
"prefer-arrow/prefer-arrow-functions": "error",
"react/react-in-jsx-scope": "off", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
"react/prop-types": "off", // Not necessary to define additional propTypes in components, as the prop type errors are handled by TS. See https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prop-types.md
"sort-imports": ["error", { ignoreCase: true, ignoreDeclarationSort: true }],
"import/no-unused-modules": "error",
"import/order": [
1,
{
groups: [["external", "builtin"], "internal", ["sibling", "parent"], "index"],
pathGroups: [
{ pattern: "components", group: "internal" },
{ pattern: "components/**", group: "internal" },
{ pattern: "assets/**", group: "internal", position: "after" },
],
pathGroupsExcludedImportTypes: ["internal"],
alphabetize: {
order: "asc",
caseInsensitive: true,
},
},
],
"sonarjs/no-duplicate-string": "off",
"import/default": "error",
"import/export": "error",
"import/first": "error",
"import/group-exports": "off", // See https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/group-exports.md
"import/namespace": "error",
"import/no-absolute-path": "error",
"import/no-anonymous-default-export": "error",
"import/no-cycle": "error",
"import/no-deprecated": "error",
"import/no-duplicates": "error",
"import/no-mutable-exports": "error",
"import/no-namespace": "error",
"import/no-relative-parent-imports": "error",
"import/no-restricted-paths": "error",
"import/no-self-import": "error",
"import/no-unused-modules": "error",
"import/no-useless-path-segments": "error",
"import/no-webpack-loader-syntax": "error",
"promise/prefer-await-to-then": "error",
"unused-imports/no-unused-imports-ts": "error",
"sonarjs/cognitive-complexity": "error",
"sonarjs/no-all-duplicated-branches": "error",
"sonarjs/no-collapsible-if": "error",
"sonarjs/no-identical-expressions": "error",
"sonarjs/no-identical-functions": "error",
"sonarjs/no-redundant-jump": "error",
"sonarjs/no-small-switch": "error",
"sonarjs/no-use-of-empty-return-value": "error",
"sonarjs/no-nested-template-literals": "error",
"sonarjs/prefer-single-boolean-return": "error",
"unicorn/consistent-destructuring": "error",
"unicorn/consistent-function-scoping": "error",
"unicorn/error-message": "error",
"unicorn/expiring-todo-comments": [
"error",
{
allowWarningComments: false,
},
], // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/expiring-todo-comments.md
"unicorn/explicit-length-check": "error",
"unicorn/import-style": "error",
"unicorn/no-abusive-eslint-disable": "error",
"unicorn/no-array-callback-reference": "error",
"unicorn/no-array-for-each": "error",
"unicorn/no-array-method-this-argument": "error",
"unicorn/no-array-reduce": "error",
"unicorn/no-await-expression-member": "error",
"unicorn/no-new-array": "error",
"unicorn/no-object-as-default-parameter": "error",
"unicorn/no-useless-undefined": ["error", { checkArguments: false }],
"unicorn/prefer-array-some": "error",
"unicorn/prefer-at": "error",
"unicorn/prefer-module": "error",
"unicorn/prefer-node-protocol": "off", // See https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md
"unicorn/prefer-number-properties": "error",
"unicorn/prefer-prototype-methods": "error",
"unicorn/prefer-spread": "error",
"unicorn/prefer-string-slice": "error",
"unicorn/prefer-ternary": "off", // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-ternary.md
"unicorn/prefer-top-level-await": "error",
},
overrides: [
{
files: ["resources/js/**/*.test.tsx", "resources/js/**/*.test.ts"],
rules: {
"@typescript-eslint/no-unsafe-call": "off",
"import/no-namespace": "off",
},
},
],
settings: {
react: {
version: "detect",
},
},
};