@szum-tech/eslint-config 2.1.15 → 2.1.16
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/README.md +44 -35
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -19,11 +19,16 @@
|
|
|
19
19
|
A shared configuration is an NPM package that exports a configuration as an array. It's super convenient for anyone to
|
|
20
20
|
use, because the configuration dynamically adapts to the needs of the project.
|
|
21
21
|
|
|
22
|
+
**✨ Ready for ESLint v10!** This configuration uses the modern flat config format and is compatible with ESLint v9.x. Full ESLint v10 support will be added once the ecosystem plugins (especially typescript-eslint) release compatible versions.
|
|
23
|
+
|
|
22
24
|
## 📚 Features
|
|
23
25
|
|
|
24
|
-
- [
|
|
26
|
+
- **[ESLint v9](https://eslint.org/)** - Latest stable version with full plugin ecosystem support (ready for v10 migration)
|
|
27
|
+
- **Flat Config Format** - Uses the modern `eslint.config.js` format (legacy `.eslintrc` is not supported)
|
|
28
|
+
- **Auto-detection** - Automatically enables plugins based on your project dependencies
|
|
29
|
+
- [Opinionated code formatter with support for: JavaScript, TypeScript, JSX, ...](https://eslint.org/)
|
|
25
30
|
- [Support linting of ES2015+ (ES6+) import/export syntax, and prevent issues with misspelling of file paths and import names](https://www.npmjs.com/package/eslint-plugin-import)
|
|
26
|
-
- [
|
|
31
|
+
- [TypeScript support](https://typescript-eslint.io/packages/typescript-eslint/) - **only** if
|
|
27
32
|
[typescript](https://www.npmjs.com/package/typescript) is used in project
|
|
28
33
|
- [React](https://www.npmjs.com/package/eslint-plugin-react) &
|
|
29
34
|
[React Hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks) specific linting rules - **only** if
|
|
@@ -67,52 +72,56 @@ use, because the configuration dynamically adapts to the needs of the project.
|
|
|
67
72
|
[@szum-tech/eslint-config](https://github.com/JanSzewczyk/eslint-config) is available as
|
|
68
73
|
[npm package](https://www.npmjs.com/package/@szum-tech/eslint-config).
|
|
69
74
|
|
|
75
|
+
**Requirements:**
|
|
76
|
+
- **ESLint** v9.0.0 or higher
|
|
77
|
+
- **Node.js** v20.x+ / v22.x+ / v24.x+
|
|
78
|
+
|
|
70
79
|
```shell
|
|
71
80
|
# NPM
|
|
72
|
-
npm install --save-dev eslint @szum-tech/eslint-config
|
|
81
|
+
npm install --save-dev eslint@latest @szum-tech/eslint-config
|
|
73
82
|
|
|
74
83
|
# YARN
|
|
75
|
-
yarn add -D eslint @szum-tech/eslint-config
|
|
84
|
+
yarn add -D eslint@latest @szum-tech/eslint-config
|
|
76
85
|
|
|
77
86
|
# PNPM
|
|
78
|
-
pnpm add --save-dev eslint @szum-tech/eslint-config
|
|
87
|
+
pnpm add --save-dev eslint@latest @szum-tech/eslint-config
|
|
79
88
|
|
|
80
89
|
# BUN
|
|
81
|
-
bun add --dev eslint @szum-tech/eslint-config
|
|
90
|
+
bun add --dev eslint@latest @szum-tech/eslint-config
|
|
82
91
|
```
|
|
83
92
|
|
|
84
93
|
### Configuration
|
|
85
94
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
A `@szum-tech/eslint-config` is an npm package that exports a configuration object or array.
|
|
95
|
+
This package uses the [ESLint Flat Config format](https://eslint.org/docs/latest/use/configure/configuration-files)
|
|
96
|
+
introduced in ESLint v9 and required in ESLint v10. The legacy `.eslintrc` format is not supported.
|
|
90
97
|
|
|
91
|
-
|
|
98
|
+
A `@szum-tech/eslint-config` is an npm package that exports a configuration array that automatically adapts to your
|
|
99
|
+
project's dependencies.
|
|
92
100
|
|
|
93
|
-
|
|
101
|
+
**Configuration file: `eslint.config.(js|cjs|mjs)`**
|
|
94
102
|
|
|
95
|
-
|
|
103
|
+
#### Simple Usage
|
|
96
104
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
Once you use a predefined configuration, you can export the entire configuration.
|
|
105
|
+
Export the entire configuration as-is:
|
|
100
106
|
|
|
101
107
|
```js
|
|
108
|
+
// eslint.config.mjs
|
|
102
109
|
export { default } from "@szum-tech/eslint-config";
|
|
103
110
|
```
|
|
104
111
|
|
|
105
|
-
|
|
106
|
-
|
|
112
|
+
#### Extended Configuration
|
|
113
|
+
|
|
114
|
+
`@szum-tech/eslint-config` is flexible enough to allow for configuration extensions. Use the spread operator to insert
|
|
115
|
+
the configuration into your array:
|
|
107
116
|
|
|
108
117
|
```js
|
|
109
|
-
// eslint.config.
|
|
118
|
+
// eslint.config.mjs
|
|
110
119
|
import szumTechEslintConfig from "@szum-tech/eslint-config";
|
|
111
120
|
|
|
112
121
|
export default [
|
|
113
122
|
...szumTechEslintConfig,
|
|
114
123
|
|
|
115
|
-
//
|
|
124
|
+
// Your custom modifications
|
|
116
125
|
{
|
|
117
126
|
rules: {
|
|
118
127
|
"no-unused-vars": "warn"
|
|
@@ -121,21 +130,18 @@ export default [
|
|
|
121
130
|
];
|
|
122
131
|
```
|
|
123
132
|
|
|
124
|
-
|
|
133
|
+
#### CommonJS Format
|
|
125
134
|
|
|
126
|
-
|
|
127
|
-
module.exports = require("@szum-tech/semantic-release-config/with-npm");
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
OR, extends
|
|
135
|
+
For projects using CommonJS:
|
|
131
136
|
|
|
132
137
|
```js
|
|
133
|
-
|
|
138
|
+
// eslint.config.cjs
|
|
139
|
+
const szumTechEslintConfig = require("@szum-tech/eslint-config");
|
|
134
140
|
|
|
135
141
|
module.exports = [
|
|
136
142
|
...szumTechEslintConfig,
|
|
137
143
|
|
|
138
|
-
//
|
|
144
|
+
// Your custom modifications
|
|
139
145
|
{
|
|
140
146
|
rules: {
|
|
141
147
|
"no-unused-vars": "warn"
|
|
@@ -144,6 +150,9 @@ module.exports = [
|
|
|
144
150
|
];
|
|
145
151
|
```
|
|
146
152
|
|
|
153
|
+
> **Note:** The configuration automatically detects which libraries are installed in your project (React, TypeScript,
|
|
154
|
+
> Next.js, Vitest, etc.) and enables the appropriate ESLint plugins and rules.
|
|
155
|
+
|
|
147
156
|
## 💻 Scripts
|
|
148
157
|
|
|
149
158
|
Suggested scripts you can add to `package.json` file:
|
|
@@ -168,11 +177,11 @@ Suggested scripts you can add to `package.json` file:
|
|
|
168
177
|
- `lint:inspect`: Launches a visual representation of the ESLint configuration file (check http://localhost:7777 in your
|
|
169
178
|
browser). Allows you to navigate through the rules, plugins, and language configurations that are enabled or disabled
|
|
170
179
|
|
|
171
|
-
## 🚀 Minimal GitHub
|
|
180
|
+
## 🚀 Minimal GitHub ESLint check workflow
|
|
172
181
|
|
|
173
|
-
Here are the minimal steps required to run an
|
|
182
|
+
Here are the minimal steps required to run an ESLint check. Creating or adding any content to a PR will trigger this
|
|
174
183
|
event. Not only will this action validate the code and return its results, but it will also add highlighted parts of the
|
|
175
|
-
code that have an error to the comments under the PR thanks to the `Upload
|
|
184
|
+
code that have an error to the comments under the PR thanks to the `Upload ESLint results to GitHub` step, which uses
|
|
176
185
|
`github/codeql-action/upload-sarif`.
|
|
177
186
|
|
|
178
187
|
```yaml
|
|
@@ -183,11 +192,11 @@ on:
|
|
|
183
192
|
|
|
184
193
|
jobs:
|
|
185
194
|
lint:
|
|
186
|
-
name:
|
|
195
|
+
name: ESLint ⬣
|
|
187
196
|
runs-on: ${{ matrix.os }}
|
|
188
197
|
strategy:
|
|
189
198
|
matrix:
|
|
190
|
-
node-version: [
|
|
199
|
+
node-version: [24.x] # Use Node.js 20+, 22+, or 24+
|
|
191
200
|
os: [ubuntu-latest]
|
|
192
201
|
steps:
|
|
193
202
|
- name: Checkout code 📚
|
|
@@ -199,10 +208,10 @@ jobs:
|
|
|
199
208
|
cache: "npm"
|
|
200
209
|
- name: Install dependencies ⚙️
|
|
201
210
|
run: npm ci
|
|
202
|
-
- name:
|
|
211
|
+
- name: ESLint Check ⬣
|
|
203
212
|
run: npm run lint:ci
|
|
204
213
|
continue-on-error: true
|
|
205
|
-
- name: Upload
|
|
214
|
+
- name: Upload ESLint results to GitHub
|
|
206
215
|
uses: github/codeql-action/upload-sarif@v3
|
|
207
216
|
with:
|
|
208
217
|
sarif_file: eslint-results.sarif
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@szum-tech/eslint-config",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.16",
|
|
4
4
|
"description": "ESLint configuration for TypeScript projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -35,31 +35,31 @@
|
|
|
35
35
|
"prettier:write": "prettier --write ."
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@next/eslint-plugin-next": "^16.
|
|
39
|
-
"@vitest/eslint-plugin": "^1.6.
|
|
38
|
+
"@next/eslint-plugin-next": "^16.1.6",
|
|
39
|
+
"@vitest/eslint-plugin": "^1.6.7",
|
|
40
40
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
41
41
|
"eslint-plugin-import": "^2.32.0",
|
|
42
42
|
"eslint-plugin-jest-dom": "^5.4.0",
|
|
43
|
-
"eslint-plugin-playwright": "^2.
|
|
43
|
+
"eslint-plugin-playwright": "^2.5.1",
|
|
44
44
|
"eslint-plugin-react": "^7.37.5",
|
|
45
45
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
46
|
-
"eslint-plugin-storybook": "^10.
|
|
46
|
+
"eslint-plugin-storybook": "^10.2.8",
|
|
47
47
|
"eslint-plugin-tailwindcss": "^4.0.0-beta.0",
|
|
48
48
|
"eslint-plugin-testing-library": "^7.13.5",
|
|
49
|
-
"globals": "^17.
|
|
50
|
-
"typescript-eslint": "^8.
|
|
49
|
+
"globals": "^17.3.0",
|
|
50
|
+
"typescript-eslint": "^8.55.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@szum-tech/prettier-config": "^1.6.2",
|
|
54
|
-
"@szum-tech/semantic-release-config": "^2.3.
|
|
55
|
-
"eslint": "^9.
|
|
56
|
-
"prettier": "^3.
|
|
57
|
-
"semantic-release": "^25.0.
|
|
54
|
+
"@szum-tech/semantic-release-config": "^2.3.7",
|
|
55
|
+
"eslint": "^9.39.2",
|
|
56
|
+
"prettier": "^3.8.1",
|
|
57
|
+
"semantic-release": "^25.0.3",
|
|
58
58
|
"tsup": "^8.5.0",
|
|
59
59
|
"typescript": "^5.8.3"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
|
-
"eslint": ">=9.
|
|
62
|
+
"eslint": ">=9.0.0"
|
|
63
63
|
},
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|