@szum-tech/eslint-config 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +90 -0
- package/index.js +437 -0
- package/package.json +79 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Szum-Tech
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# @szum-tech/eslint-config
|
|
2
|
+
|
|
3
|
+
> Github
|
|
4
|
+
>
|
|
5
|
+
>  > [](https://github.com/JanSzewczyk/eslint-config-szum-tech/pulls) > [](https://github.com/JanSzewczyk/eslint-config-szum-tech/issues) > 
|
|
6
|
+
|
|
7
|
+
> Github Actions
|
|
8
|
+
>
|
|
9
|
+
> [](https://github.com/JanSzewczyk/eslint-config-szum-tech/actions/workflows/publish.yml) > [](https://github.com/JanSzewczyk/eslint-config-szum-tech/actions/workflows/test.yml) > [](https://github.com/JanSzewczyk/eslint-config-szum-tech/actions/workflows/codeql.yml)
|
|
10
|
+
|
|
11
|
+
> NPM
|
|
12
|
+
>
|
|
13
|
+
> [](https://www.npmjs.com/package/@szum-tech/eslint-config-szum-tech) > 
|
|
14
|
+
|
|
15
|
+
[](https://github.com/JanSzewczyk/eslint-config-szum-tech/blob/main/LICENSE)
|
|
16
|
+
|
|
17
|
+
These are settings for ESLint working
|
|
18
|
+
as [shareable config](http://eslint.org/docs/developer-guide/shareable-configs.html).
|
|
19
|
+
|
|
20
|
+
## What it does 🤔
|
|
21
|
+
|
|
22
|
+
This setup lints your JavaScript code based on practices. It supports [React](https://reactjs.org/) projects with
|
|
23
|
+
typescript and uses plugins like:
|
|
24
|
+
|
|
25
|
+

|
|
26
|
+
|
|
27
|
+

|
|
28
|
+
|
|
29
|
+

|
|
30
|
+
|
|
31
|
+

|
|
32
|
+
|
|
33
|
+
Check the [index.js](https://github.com/JanSzewczyk/eslint-config-szum-tech/blob/main/index.js) file to see what is
|
|
34
|
+
included. Feel free to override the rules that make sense for you.
|
|
35
|
+
|
|
36
|
+
## Installing ⚙️
|
|
37
|
+
|
|
38
|
+
In your project folder, run:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
npm i -D @szum-tech/eslint-config-szum-tech
|
|
42
|
+
# or yarn install --dev @szum-tech/eslint-config-szum-tech
|
|
43
|
+
|
|
44
|
+
npx install-peerdeps --dev @szum-tech/eslint-config-szum-tech
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
Once the `@szum-tech/eslint-config-szum-tech` package is installed, you can use it by specifying
|
|
50
|
+
`@szum-tech/eslint-config-szum-tech` in
|
|
51
|
+
the [extends](https://eslint.org/docs/user-guide/configuring/#extending-configuration-files)
|
|
52
|
+
section of your [ESLint configuration](https://eslint.org/docs/user-guide/configuring/).
|
|
53
|
+
|
|
54
|
+
### Set configuration
|
|
55
|
+
|
|
56
|
+
Use one of following way:
|
|
57
|
+
|
|
58
|
+
#### 1. Create (or update) a `.eslintrc.yml` file with the following content:
|
|
59
|
+
|
|
60
|
+
```yaml
|
|
61
|
+
extends:
|
|
62
|
+
- "@szum-tech/eslint-config-szum-tech"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
#### 2. Or add to `package.json` file the following content:
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"eslintConfig": {
|
|
70
|
+
"extends": ["@szum-tech/eslint-config-szum-tech"]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
### Add scripts to `package.json`
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"scripts": {
|
|
82
|
+
"lint": "eslint {**/*,*}.{js,ts,jsx,tsx}",
|
|
83
|
+
"lint:fix": "eslint --fix {**/*,*}.{js,ts,jsx,tsx}"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## License
|
|
89
|
+
|
|
90
|
+
MIT © Szum-Tech
|
package/index.js
ADDED
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
import importPlugin from "eslint-plugin-import";
|
|
2
|
+
import jestDomPlugin from "eslint-plugin-jest-dom";
|
|
3
|
+
import playwrightPlugin from "eslint-plugin-playwright";
|
|
4
|
+
import reactPlugin from "eslint-plugin-react";
|
|
5
|
+
import reactHooksPlugin from "eslint-plugin-react-hooks";
|
|
6
|
+
import storybookPlugin from "eslint-plugin-storybook";
|
|
7
|
+
import tailwindcssPlugin from "eslint-plugin-tailwindcss";
|
|
8
|
+
import testingLibraryPlugin from "eslint-plugin-testing-library";
|
|
9
|
+
import globals from "globals";
|
|
10
|
+
import tsEslint from "typescript-eslint";
|
|
11
|
+
|
|
12
|
+
import nextPlugin from "@next/eslint-plugin-next";
|
|
13
|
+
import vitestPlugin from "@vitest/eslint-plugin";
|
|
14
|
+
|
|
15
|
+
const ERROR = "error";
|
|
16
|
+
const WARN = "warn";
|
|
17
|
+
const OFF = "off";
|
|
18
|
+
|
|
19
|
+
const has = (pkg) => {
|
|
20
|
+
try {
|
|
21
|
+
import.meta.resolve(pkg, import.meta.url);
|
|
22
|
+
return true;
|
|
23
|
+
} catch {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const hasTypeScript = has("typescript");
|
|
29
|
+
const hasTailwindcss = has("tailwindcss");
|
|
30
|
+
const hasReact = has("react");
|
|
31
|
+
const hasNext = has("next");
|
|
32
|
+
const hasTestingLibrary = has("@testing-library/dom");
|
|
33
|
+
const hasJestDom = has("@testing-library/jest-dom");
|
|
34
|
+
const hasVitest = has("vitest");
|
|
35
|
+
const hasPlaywright = has("@playwright/test");
|
|
36
|
+
const hasStorybook = has("storybook");
|
|
37
|
+
|
|
38
|
+
const vitestFiles = ["**/__tests__/**/*", "**/*.test.*"];
|
|
39
|
+
const testFiles = ["**/tests/**", ...vitestFiles];
|
|
40
|
+
const playwrightFiles = ["**/e2e/**", "**/*.e2e.*"];
|
|
41
|
+
|
|
42
|
+
export const config = [
|
|
43
|
+
{
|
|
44
|
+
name: "eslint/ignores",
|
|
45
|
+
ignores: [
|
|
46
|
+
"**/.cache/**",
|
|
47
|
+
"**/node_modules/**",
|
|
48
|
+
"**/build/**",
|
|
49
|
+
"**/public/build/**",
|
|
50
|
+
"**/playwright-report/**",
|
|
51
|
+
"**/server-build/**",
|
|
52
|
+
"**/dist/**",
|
|
53
|
+
"**/.next/**"
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
{
|
|
58
|
+
name: "eslint/config/base&import",
|
|
59
|
+
plugins: {
|
|
60
|
+
import: importPlugin
|
|
61
|
+
},
|
|
62
|
+
languageOptions: {
|
|
63
|
+
globals: {
|
|
64
|
+
...globals.browser,
|
|
65
|
+
...globals.node
|
|
66
|
+
},
|
|
67
|
+
parserOptions: {
|
|
68
|
+
warnOnUnsupportedTypeScriptVersion: false
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
rules: {
|
|
72
|
+
"no-unexpected-multiline": ERROR,
|
|
73
|
+
"no-warning-comments": [ERROR, { terms: ["FIXME"], location: "anywhere" }],
|
|
74
|
+
"no-console": WARN,
|
|
75
|
+
"no-unused-vars": [
|
|
76
|
+
WARN,
|
|
77
|
+
{
|
|
78
|
+
args: "after-used",
|
|
79
|
+
argsIgnorePattern: "^_",
|
|
80
|
+
ignoreRestSiblings: true,
|
|
81
|
+
varsIgnorePattern: "^ignored"
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
|
|
85
|
+
// analysis/correctness
|
|
86
|
+
"import/default": ERROR,
|
|
87
|
+
"import/namespace": ERROR,
|
|
88
|
+
"import/export": ERROR,
|
|
89
|
+
"import/no-unresolved": OFF,
|
|
90
|
+
"import/named": OFF,
|
|
91
|
+
|
|
92
|
+
// red flags (thus, warnings)
|
|
93
|
+
"import/consistent-type-specifier-style": [WARN, "prefer-inline"],
|
|
94
|
+
"import/no-named-as-default": WARN,
|
|
95
|
+
"import/no-named-as-default-member": WARN,
|
|
96
|
+
"import/no-duplicates": [WARN, { "prefer-inline": true }],
|
|
97
|
+
"import/order": [
|
|
98
|
+
WARN,
|
|
99
|
+
{
|
|
100
|
+
groups: ["builtin", "external", "internal", "parent", "sibling", "index"],
|
|
101
|
+
pathGroups: [
|
|
102
|
+
{
|
|
103
|
+
pattern: "react",
|
|
104
|
+
group: "external",
|
|
105
|
+
position: "before"
|
|
106
|
+
},
|
|
107
|
+
{ pattern: "*/**", group: "internal" }
|
|
108
|
+
],
|
|
109
|
+
pathGroupsExcludedImportTypes: ["react"],
|
|
110
|
+
"newlines-between": "always",
|
|
111
|
+
alphabetize: {
|
|
112
|
+
order: "asc",
|
|
113
|
+
caseInsensitive: true
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
hasReact
|
|
121
|
+
? {
|
|
122
|
+
name: "eslint/config/react&react-hooks",
|
|
123
|
+
files: ["**/*.tsx", "**/*.jsx"],
|
|
124
|
+
plugins: {
|
|
125
|
+
react: reactPlugin,
|
|
126
|
+
"react-hooks": reactHooksPlugin
|
|
127
|
+
},
|
|
128
|
+
languageOptions: {
|
|
129
|
+
parser: tsEslint.parser,
|
|
130
|
+
parserOptions: {
|
|
131
|
+
jsx: true
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
settings: {
|
|
135
|
+
react: {
|
|
136
|
+
version: "detect"
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
rules: {
|
|
140
|
+
"react/display-name": ERROR,
|
|
141
|
+
"react/jsx-no-comment-textnodes": ERROR,
|
|
142
|
+
"react/jsx-no-duplicate-props": ERROR,
|
|
143
|
+
"react/jsx-no-target-blank": ERROR,
|
|
144
|
+
"react/jsx-no-undef": ERROR,
|
|
145
|
+
"react/jsx-uses-react": ERROR,
|
|
146
|
+
"react/jsx-uses-vars": ERROR,
|
|
147
|
+
"react/no-children-prop": ERROR,
|
|
148
|
+
"react/no-danger-with-children": ERROR,
|
|
149
|
+
"react/no-deprecated": ERROR,
|
|
150
|
+
"react/no-direct-mutation-state": ERROR,
|
|
151
|
+
"react/no-find-dom-node": ERROR,
|
|
152
|
+
"react/no-is-mounted": ERROR,
|
|
153
|
+
"react/no-render-return-value": ERROR,
|
|
154
|
+
"react/no-unescaped-entities": ERROR,
|
|
155
|
+
"react/no-unknown-property": ERROR,
|
|
156
|
+
"react/require-render-return": ERROR,
|
|
157
|
+
"react/jsx-key": WARN,
|
|
158
|
+
"react/react-in-jsx-scope": OFF,
|
|
159
|
+
"react/no-unsafe": OFF,
|
|
160
|
+
|
|
161
|
+
"react-hooks/rules-of-hooks": ERROR,
|
|
162
|
+
"react-hooks/exhaustive-deps": WARN
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
: null,
|
|
166
|
+
|
|
167
|
+
hasTailwindcss
|
|
168
|
+
? {
|
|
169
|
+
name: "eslint/config/tailwindcss",
|
|
170
|
+
plugins: {
|
|
171
|
+
tailwindcss: tailwindcssPlugin
|
|
172
|
+
},
|
|
173
|
+
languageOptions: {
|
|
174
|
+
parserOptions: {
|
|
175
|
+
ecmaFeatures: {
|
|
176
|
+
jsx: true
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
rules: {
|
|
181
|
+
"tailwindcss/no-contradicting-classname": ERROR,
|
|
182
|
+
"tailwindcss/classnames-order": WARN,
|
|
183
|
+
"tailwindcss/enforces-negative-arbitrary-values": WARN,
|
|
184
|
+
"tailwindcss/enforces-shorthand": WARN,
|
|
185
|
+
"tailwindcss/migration-from-tailwind-2": WARN,
|
|
186
|
+
"tailwindcss/no-custom-classname": WARN,
|
|
187
|
+
"tailwindcss/no-unnecessary-arbitrary-value": WARN,
|
|
188
|
+
"tailwindcss/no-arbitrary-value": OFF
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
: null,
|
|
192
|
+
|
|
193
|
+
hasNext
|
|
194
|
+
? {
|
|
195
|
+
name: "eslint/config/next",
|
|
196
|
+
files: ["**/*.ts?(x)", "**/*.js?(x)"],
|
|
197
|
+
plugins: {
|
|
198
|
+
"@next/next": nextPlugin
|
|
199
|
+
},
|
|
200
|
+
rules: {
|
|
201
|
+
"@next/next/inline-script-id": ERROR,
|
|
202
|
+
"@next/next/no-assign-module-variable": ERROR,
|
|
203
|
+
"@next/next/no-document-import-in-page": ERROR,
|
|
204
|
+
"@next/next/no-duplicate-head": ERROR,
|
|
205
|
+
"@next/next/no-head-import-in-document": ERROR,
|
|
206
|
+
"@next/next/no-script-component-in-head": ERROR,
|
|
207
|
+
"@next/next/google-font-display": WARN,
|
|
208
|
+
"@next/next/google-font-preconnect": WARN,
|
|
209
|
+
"@next/next/next-script-for-ga": WARN,
|
|
210
|
+
"@next/next/no-async-client-component": WARN,
|
|
211
|
+
"@next/next/no-before-interactive-script-outside-document": WARN,
|
|
212
|
+
"@next/next/no-css-tags": WARN,
|
|
213
|
+
"@next/next/no-head-element": WARN,
|
|
214
|
+
"@next/next/no-html-link-for-pages": WARN,
|
|
215
|
+
"@next/next/no-img-element": WARN,
|
|
216
|
+
"@next/next/no-page-custom-font": WARN,
|
|
217
|
+
"@next/next/no-styled-jsx-in-document": WARN,
|
|
218
|
+
"@next/next/no-sync-scripts": WARN,
|
|
219
|
+
"@next/next/no-title-in-document-head": WARN,
|
|
220
|
+
"@next/next/no-typos": WARN,
|
|
221
|
+
"@next/next/no-unwanted-polyfillio": WARN
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
: null,
|
|
225
|
+
|
|
226
|
+
hasTypeScript
|
|
227
|
+
? {
|
|
228
|
+
name: "eslint/config/typescript",
|
|
229
|
+
files: ["**/*.ts?(x)"],
|
|
230
|
+
languageOptions: {
|
|
231
|
+
parser: tsEslint.parser,
|
|
232
|
+
parserOptions: {
|
|
233
|
+
projectService: true
|
|
234
|
+
},
|
|
235
|
+
sourceType: "module"
|
|
236
|
+
},
|
|
237
|
+
plugins: {
|
|
238
|
+
"@typescript-eslint": tsEslint.plugin
|
|
239
|
+
},
|
|
240
|
+
rules: {
|
|
241
|
+
"no-unused-expressions": OFF,
|
|
242
|
+
"no-array-constructor": OFF,
|
|
243
|
+
"no-unused-vars": OFF,
|
|
244
|
+
|
|
245
|
+
"@typescript-eslint/no-misused-promises": [ERROR, { checksVoidReturn: false }],
|
|
246
|
+
"@typescript-eslint/no-floating-promises": ERROR,
|
|
247
|
+
"@typescript-eslint/ban-ts-comment": ERROR,
|
|
248
|
+
"@typescript-eslint/no-array-constructor": ERROR,
|
|
249
|
+
"@typescript-eslint/no-duplicate-enum-values": ERROR,
|
|
250
|
+
"@typescript-eslint/no-explicit-any": ERROR,
|
|
251
|
+
"@typescript-eslint/no-extra-non-null-assertion": ERROR,
|
|
252
|
+
"@typescript-eslint/no-misused-new": ERROR,
|
|
253
|
+
"@typescript-eslint/no-namespace": ERROR,
|
|
254
|
+
"@typescript-eslint/no-non-null-asserted-optional-chain": ERROR,
|
|
255
|
+
"@typescript-eslint/no-require-imports": ERROR,
|
|
256
|
+
"@typescript-eslint/no-this-alias": ERROR,
|
|
257
|
+
"@typescript-eslint/no-unnecessary-type-constraint": ERROR,
|
|
258
|
+
"@typescript-eslint/no-unsafe-declaration-merging": ERROR,
|
|
259
|
+
"@typescript-eslint/no-unsafe-function-type": ERROR,
|
|
260
|
+
"@typescript-eslint/no-wrapper-object-types": ERROR,
|
|
261
|
+
"@typescript-eslint/prefer-as-const": "error",
|
|
262
|
+
"@typescript-eslint/prefer-namespace-keyword": ERROR,
|
|
263
|
+
"@typescript-eslint/triple-slash-reference": ERROR,
|
|
264
|
+
"@typescript-eslint/no-empty-object-type": WARN,
|
|
265
|
+
"@typescript-eslint/no-unused-vars": [
|
|
266
|
+
WARN,
|
|
267
|
+
{
|
|
268
|
+
args: "all",
|
|
269
|
+
argsIgnorePattern: "^_",
|
|
270
|
+
caughtErrors: "all",
|
|
271
|
+
caughtErrorsIgnorePattern: "^_",
|
|
272
|
+
destructuredArrayIgnorePattern: "^_",
|
|
273
|
+
varsIgnorePattern: "^_",
|
|
274
|
+
ignoreRestSiblings: true
|
|
275
|
+
}
|
|
276
|
+
],
|
|
277
|
+
"@typescript-eslint/consistent-type-imports": [
|
|
278
|
+
WARN,
|
|
279
|
+
{
|
|
280
|
+
prefer: "type-imports",
|
|
281
|
+
disallowTypeAnnotations: true,
|
|
282
|
+
fixStyle: "inline-type-imports"
|
|
283
|
+
}
|
|
284
|
+
]
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
: null,
|
|
288
|
+
|
|
289
|
+
hasTestingLibrary
|
|
290
|
+
? {
|
|
291
|
+
name: "eslint/config/testing-library",
|
|
292
|
+
files: testFiles,
|
|
293
|
+
ignores: playwrightFiles,
|
|
294
|
+
plugins: {
|
|
295
|
+
"testing-library": testingLibraryPlugin
|
|
296
|
+
},
|
|
297
|
+
rules: {
|
|
298
|
+
"testing-library/no-unnecessary-act": [ERROR, { isStrict: false }],
|
|
299
|
+
"testing-library/no-wait-for-side-effects": ERROR,
|
|
300
|
+
"testing-library/prefer-find-by": ERROR
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
: null,
|
|
304
|
+
|
|
305
|
+
hasJestDom
|
|
306
|
+
? {
|
|
307
|
+
name: "eslint/config/jest-dom",
|
|
308
|
+
files: testFiles,
|
|
309
|
+
ignores: playwrightFiles,
|
|
310
|
+
plugins: {
|
|
311
|
+
"jest-dom": jestDomPlugin
|
|
312
|
+
},
|
|
313
|
+
rules: {
|
|
314
|
+
"jest-dom/prefer-checked": ERROR,
|
|
315
|
+
"jest-dom/prefer-enabled-disabled": ERROR,
|
|
316
|
+
"jest-dom/prefer-focus": ERROR,
|
|
317
|
+
"jest-dom/prefer-empty": ERROR,
|
|
318
|
+
"jest-dom/prefer-to-have-value": ERROR,
|
|
319
|
+
"jest-dom/prefer-to-have-text-content": ERROR,
|
|
320
|
+
"jest-dom/prefer-required": ERROR
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
: null,
|
|
324
|
+
|
|
325
|
+
hasVitest
|
|
326
|
+
? {
|
|
327
|
+
name: "eslint/config/vitest",
|
|
328
|
+
files: testFiles,
|
|
329
|
+
ignores: playwrightFiles,
|
|
330
|
+
plugins: {
|
|
331
|
+
vitest: vitestPlugin
|
|
332
|
+
},
|
|
333
|
+
settings: {
|
|
334
|
+
vitest: {
|
|
335
|
+
typecheck: hasTypeScript
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
languageOptions: {
|
|
339
|
+
globals: {
|
|
340
|
+
...vitestPlugin.environments.env.globals
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
rules: {
|
|
344
|
+
"vitest/expect-expect": ERROR,
|
|
345
|
+
"vitest/no-identical-title": ERROR,
|
|
346
|
+
"vitest/no-commented-out-tests": ERROR,
|
|
347
|
+
"vitest/valid-title": ERROR,
|
|
348
|
+
"vitest/valid-expect": ERROR,
|
|
349
|
+
"vitest/valid-describe-callback": ERROR,
|
|
350
|
+
"vitest/require-local-test-context-for-concurrent-snapshots": ERROR,
|
|
351
|
+
"vitest/no-import-node-test": ERROR,
|
|
352
|
+
"vitest/no-focused-tests": [WARN, { fixable: false }]
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
: null,
|
|
356
|
+
|
|
357
|
+
hasPlaywright
|
|
358
|
+
? {
|
|
359
|
+
name: "eslint/config/playwright",
|
|
360
|
+
files: playwrightFiles,
|
|
361
|
+
|
|
362
|
+
plugins: {
|
|
363
|
+
playwright: playwrightPlugin
|
|
364
|
+
},
|
|
365
|
+
languageOptions: {
|
|
366
|
+
globals: globals["shared-node-browser"]
|
|
367
|
+
},
|
|
368
|
+
rules: {
|
|
369
|
+
"no-empty-pattern": OFF,
|
|
370
|
+
|
|
371
|
+
"playwright/missing-playwright-await": ERROR,
|
|
372
|
+
"playwright/no-focused-test": ERROR,
|
|
373
|
+
"playwright/no-networkidle": ERROR,
|
|
374
|
+
"playwright/no-unsafe-references": ERROR,
|
|
375
|
+
"playwright/valid-describe-callback": ERROR,
|
|
376
|
+
"playwright/valid-expect": ERROR,
|
|
377
|
+
"playwright/valid-expect-in-promise": ERROR,
|
|
378
|
+
"playwright/valid-title": ERROR,
|
|
379
|
+
"playwright/prefer-web-first-assertions": ERROR,
|
|
380
|
+
"playwright/no-standalone-expect": ERROR,
|
|
381
|
+
"playwright/expect-expect": WARN,
|
|
382
|
+
"playwright/max-nested-describe": WARN,
|
|
383
|
+
"playwright/no-conditional-expect": WARN,
|
|
384
|
+
"playwright/no-conditional-in-test": WARN,
|
|
385
|
+
"playwright/no-element-handle": WARN,
|
|
386
|
+
"playwright/no-eval": WARN,
|
|
387
|
+
"playwright/no-force-option": WARN,
|
|
388
|
+
"playwright/no-nested-step": WARN,
|
|
389
|
+
"playwright/no-page-pause": WARN,
|
|
390
|
+
"playwright/no-skipped-test": WARN,
|
|
391
|
+
"playwright/no-useless-await": WARN,
|
|
392
|
+
"playwright/no-useless-not": WARN,
|
|
393
|
+
"playwright/no-wait-for-selector": WARN,
|
|
394
|
+
"playwright/no-wait-for-timeout": WARN
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
: null,
|
|
398
|
+
|
|
399
|
+
hasStorybook
|
|
400
|
+
? {
|
|
401
|
+
name: "eslint/config/storybook",
|
|
402
|
+
plugins: {
|
|
403
|
+
storybook: storybookPlugin
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
: null,
|
|
407
|
+
hasStorybook
|
|
408
|
+
? {
|
|
409
|
+
name: "eslint/config/storybook/stories",
|
|
410
|
+
files: ["**/*.stories.@(ts|tsx|js|jsx|mjs|cjs)", "**/*.story.@(ts|tsx|js|jsx|mjs|cjs)"],
|
|
411
|
+
rules: {
|
|
412
|
+
"storybook/await-interactions": ERROR,
|
|
413
|
+
"storybook/context-in-play-function": ERROR,
|
|
414
|
+
"storybook/default-exports": ERROR,
|
|
415
|
+
"storybook/story-exports": ERROR,
|
|
416
|
+
"storybook/use-storybook-expect": ERROR,
|
|
417
|
+
"storybook/use-storybook-testing-library": ERROR,
|
|
418
|
+
"storybook/no-redundant-story-name": WARN,
|
|
419
|
+
"storybook/prefer-pascal-case": WARN,
|
|
420
|
+
"storybook/hierarchy-separator": WARN,
|
|
421
|
+
"react-hooks/rules-of-hooks": OFF,
|
|
422
|
+
"import/no-anonymous-default-export": OFF
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
: null,
|
|
426
|
+
hasStorybook
|
|
427
|
+
? {
|
|
428
|
+
name: "eslint/config/storybook/main",
|
|
429
|
+
files: [".storybook/main.@(js|cjs|mjs|ts|tsx)"],
|
|
430
|
+
rules: {
|
|
431
|
+
"storybook/no-uninstalled-addons": ERROR
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
: null
|
|
435
|
+
].filter(Boolean);
|
|
436
|
+
|
|
437
|
+
export default config;
|
package/package.json
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@szum-tech/eslint-config",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "ESLint configuration for TypeScript projects",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"eslint",
|
|
7
|
+
"eslint-config",
|
|
8
|
+
"react",
|
|
9
|
+
"eslintconfig",
|
|
10
|
+
"szum-tech"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/JanSzewczyk/eslint-config#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/JanSzewczyk/eslint-config/issues"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/JanSzewczyk/eslint-config.git"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"author": "Jan Szewczyk (Szum-Tech)",
|
|
22
|
+
"type": "module",
|
|
23
|
+
"main": "index.js",
|
|
24
|
+
"module": "index.js",
|
|
25
|
+
"files": [
|
|
26
|
+
"index.js"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"lint": "eslint .",
|
|
30
|
+
"lint:ci": "eslint . --max-warnings=0",
|
|
31
|
+
"lint:fix": "eslint . --fix",
|
|
32
|
+
"lint:inspect": "npx @eslint/config-inspector@latest",
|
|
33
|
+
"prettier:check": "prettier --check .",
|
|
34
|
+
"prettier:write": "prettier --write .",
|
|
35
|
+
"semantic-release": "semantic-release",
|
|
36
|
+
"test": "node test/test.test.js"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@next/eslint-plugin-next": "^15.0.3",
|
|
40
|
+
"@vitest/eslint-plugin": "^1.1.10",
|
|
41
|
+
"eslint-config-prettier": "^9.1.0",
|
|
42
|
+
"eslint-plugin-import": "^2.31.0",
|
|
43
|
+
"eslint-plugin-jest-dom": "^5.4.0",
|
|
44
|
+
"eslint-plugin-playwright": "^2.0.1",
|
|
45
|
+
"eslint-plugin-react": "^7.37.1",
|
|
46
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
47
|
+
"eslint-plugin-storybook": "^0.11.0",
|
|
48
|
+
"eslint-plugin-tailwindcss": "^3.17.5",
|
|
49
|
+
"eslint-plugin-testing-library": "^6.5.0",
|
|
50
|
+
"globals": "^15.12.0",
|
|
51
|
+
"typescript-eslint": "^8.15.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@szum-tech/prettier-config": "^1.3.5",
|
|
55
|
+
"@szum-tech/semantic-release-preset": "^1.5.7",
|
|
56
|
+
"eslint": "^9.15.0",
|
|
57
|
+
"prettier": "^3.3.3",
|
|
58
|
+
"semantic-release": "^24.2.0"
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"@next/eslint-plugin-next": "^15.0.3",
|
|
62
|
+
"@vitest/eslint-plugin": "^1.1.10",
|
|
63
|
+
"eslint": "^9.15.0",
|
|
64
|
+
"eslint-config-prettier": "^9.1.0",
|
|
65
|
+
"eslint-plugin-import": "^2.31.0",
|
|
66
|
+
"eslint-plugin-jest-dom": "^5.4.0",
|
|
67
|
+
"eslint-plugin-playwright": "^2.0.1",
|
|
68
|
+
"eslint-plugin-react": "^7.37.1",
|
|
69
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
70
|
+
"eslint-plugin-storybook": "^0.11.0",
|
|
71
|
+
"eslint-plugin-tailwindcss": "^3.17.5",
|
|
72
|
+
"eslint-plugin-testing-library": "^6.5.0",
|
|
73
|
+
"globals": "^15.12.0",
|
|
74
|
+
"typescript-eslint": "^8.15.0"
|
|
75
|
+
},
|
|
76
|
+
"publishConfig": {
|
|
77
|
+
"access": "public"
|
|
78
|
+
}
|
|
79
|
+
}
|