@codfish/eslint-config 0.0.0-PR-155--2a9a213 → 0.0.0-PR-124--0da7f69
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 +88 -252
- package/dist/dapp.d.ts +1 -1
- package/dist/docker.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/rules/config-files.d.ts +1 -1
- package/dist/rules/jest.d.ts +3 -0
- package/dist/rules/jest.d.ts.map +1 -0
- package/dist/rules/react.d.ts +1 -1
- package/dist/rules/vitest.d.ts +3 -0
- package/dist/rules/vitest.d.ts.map +1 -0
- package/dist/utils.d.ts +0 -5
- package/dist/utils.d.ts.map +1 -1
- package/index.js +34 -152
- package/package.json +27 -38
- package/rules/jest.js +35 -0
- package/rules/react.js +17 -49
- package/rules/vitest.js +40 -0
- package/utils.js +5 -13
- package/dist/rules/tests.d.ts +0 -3
- package/dist/rules/tests.d.ts.map +0 -1
- package/dist/rules/typescript.d.ts +0 -38
- package/dist/rules/typescript.d.ts.map +0 -1
- package/dist/tests/integration/eslint-execution.spec.d.ts +0 -2
- package/dist/tests/integration/eslint-execution.spec.d.ts.map +0 -1
- package/dist/tests/integration/react-integration.spec.d.ts +0 -2
- package/dist/tests/integration/react-integration.spec.d.ts.map +0 -1
- package/dist/tests/integration/rule-application.spec.d.ts +0 -2
- package/dist/tests/integration/rule-application.spec.d.ts.map +0 -1
- package/dist/tests/scenarios/edge-cases.spec.d.ts +0 -2
- package/dist/tests/scenarios/edge-cases.spec.d.ts.map +0 -1
- package/dist/tests/unit/config-loading.spec.d.ts +0 -2
- package/dist/tests/unit/config-loading.spec.d.ts.map +0 -1
- package/dist/tests/unit/dynamic-detection.spec.d.ts +0 -2
- package/dist/tests/unit/dynamic-detection.spec.d.ts.map +0 -1
- package/dist/tests/unit/utils.spec.d.ts +0 -2
- package/dist/tests/unit/utils.spec.d.ts.map +0 -1
- package/dist/vitest.config.d.ts +0 -3
- package/dist/vitest.config.d.ts.map +0 -1
- package/rules/tests.js +0 -52
- package/rules/typescript.js +0 -56
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @codfish/eslint-config
|
|
2
2
|
|
|
3
|
-
> Modern ESLint configuration with TypeScript, React/Next.js, YAML, Testing Library, and testing framework
|
|
4
|
-
> ESLint
|
|
3
|
+
> Modern ESLint configuration with TypeScript, React/Next.js, Tailwind CSS, YAML, Testing Library, and testing framework
|
|
4
|
+
> support using ESLint v9+ flat config format.
|
|
5
5
|
|
|
6
6
|
[](http://npm.im/@codfish/eslint-config)
|
|
7
7
|
[](http://npm-stat.com/charts.html?package=@codfish/eslint-config&from=2015-08-01)
|
|
@@ -15,19 +15,16 @@
|
|
|
15
15
|
## Table of Contents
|
|
16
16
|
|
|
17
17
|
- [Features](#features)
|
|
18
|
+
- [Automatic Configuration](#automatic-configuration)
|
|
19
|
+
- [Opinionated Highlights](#opinionated-highlights)
|
|
18
20
|
- [Installation](#installation)
|
|
19
21
|
- [Usage](#usage)
|
|
20
|
-
- [
|
|
21
|
-
- [
|
|
22
|
-
- [VS Code / Cursor](#vs-code--cursor)
|
|
22
|
+
- [Docker Configuration](#docker-configuration)
|
|
23
|
+
- [dApps Configuration](#dapps-configuration)
|
|
23
24
|
- [Prettier Configuration](#prettier-configuration)
|
|
24
|
-
- [Use in combination with prettier-plugin-tailwindcss](#use-in-combination-with-prettier-plugin-tailwindcss)
|
|
25
25
|
- [Example scripts](#example-scripts)
|
|
26
26
|
- [Commitlint Configuration](#commitlint-configuration)
|
|
27
|
-
- [
|
|
28
|
-
- [Breaking Changes in ESLint 10](#breaking-changes-in-eslint-10)
|
|
29
|
-
- [Migration Steps](#migration-steps)
|
|
30
|
-
- [What Changed](#what-changed)
|
|
27
|
+
- [Known issues](#known-issues)
|
|
31
28
|
- [Migration from Legacy Config](#migration-from-legacy-config)
|
|
32
29
|
|
|
33
30
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
@@ -35,53 +32,73 @@
|
|
|
35
32
|
|
|
36
33
|
## Features
|
|
37
34
|
|
|
38
|
-
- **Modern ESLint
|
|
35
|
+
- **Modern ESLint v9+ flat config**: Uses the new flat configuration format
|
|
39
36
|
- **Dynamic feature detection**: Automatically configures based on your project's dependencies
|
|
40
37
|
- **TypeScript support**: Full TypeScript linting with modern typescript-eslint parser and rules
|
|
41
38
|
- **React ecosystem**: React, React Hooks, and JSX accessibility rules when React is detected
|
|
42
39
|
- **Next.js support**: Automatically configures Next.js official plugin linting rules when detected
|
|
43
40
|
- **Test framework agnostic**: Supports Jest and Vitest with automatic detection
|
|
44
41
|
- **Testing Library integration**: Automatically includes Testing Library rules for test files
|
|
45
|
-
- **
|
|
42
|
+
- **Tailwind CSS support**: Automatically configures Tailwind CSS linting when detected
|
|
43
|
+
- **YAML/YML support**: Built-in linting for YAML configuration files
|
|
46
44
|
- **Prettier integration**: Built-in Prettier configuration with conflict resolution via eslint-config-prettier
|
|
47
45
|
- **ESM architecture**: Built with ECMAScript modules and full TypeScript typing
|
|
48
46
|
- **Docker support**: Optional configuration for dockerized applications
|
|
49
47
|
- **Blockchain/dApp support**: Optional configuration for decentralized applications
|
|
50
48
|
|
|
49
|
+
### Automatic Configuration
|
|
50
|
+
|
|
51
|
+
The config automatically detects and configures:
|
|
52
|
+
|
|
53
|
+
- **React**: Includes React, React Hooks, and JSX a11y rules when `react` is installed
|
|
54
|
+
- **Next.js**: Includes Next.js recommended and Core Web Vitals rules when `next` is detected
|
|
55
|
+
- **Jest**: Configures Jest-specific rules when `jest` is found in dependencies
|
|
56
|
+
- **Vitest**: Configures Vitest-specific rules when `vitest` is detected
|
|
57
|
+
- **Testing Library**: Automatically adds Testing Library rules for test files in Jest/Vitest projects
|
|
58
|
+
- **Tailwind CSS**: Includes Tailwind CSS linting rules when `tailwindcss` is detected
|
|
59
|
+
- **YAML files**: Always includes YAML/YML file linting support
|
|
60
|
+
- **Prettier**: Loads your project's Prettier config or falls back to [my defaults](./prettier.js)
|
|
61
|
+
|
|
62
|
+
### Opinionated Highlights
|
|
63
|
+
|
|
64
|
+
This configuration includes some opinionated settings that you might want to customize for your project:
|
|
65
|
+
|
|
66
|
+
**Prettier/Formatting:**
|
|
67
|
+
|
|
68
|
+
- **Semicolons**: Enforces semicolons (`;`)
|
|
69
|
+
- **120 character line width**: Wider than the common 80/100 - you might prefer shorter lines
|
|
70
|
+
- **2-space indentation**: Uses 2 spaces for tabs
|
|
71
|
+
- **Single quotes**: Prefers `'single'` over `"double"` quotes
|
|
72
|
+
- **Trailing commas**: Adds trailing commas everywhere
|
|
73
|
+
- **Arrow parentheses**: Avoids parens around single args (`x => x` not `(x) => x`)
|
|
74
|
+
|
|
75
|
+
**ESLint Rules:**
|
|
76
|
+
|
|
77
|
+
- **Import sorting**: Enforces automatic import organization with specific grouping rules
|
|
78
|
+
- **Lodash restrictions**: Requires direct imports (`import get from 'lodash-es/get'`) instead of full lodash
|
|
79
|
+
- **React hooks deps**: Disables `exhaustive-deps` rule - you might want this stricter
|
|
80
|
+
- **Console statements**: Disallows `console.log` in regular code (only allowed in test files) - some teams prefer
|
|
81
|
+
warnings instead of errors
|
|
82
|
+
- **Next.js rules**: Enforces Next.js best practices and Core Web Vitals optimization
|
|
83
|
+
- **Tailwind class sorting**: Automatically sorts Tailwind classes (can break dynamic class builds - see Known Issues)
|
|
84
|
+
- **Testing Library rules**: Enforces Testing Library best practices in test files
|
|
85
|
+
|
|
86
|
+
**File Ignores:**
|
|
87
|
+
|
|
88
|
+
- Ignores common build directories (`.next`, `coverage`, `.vercel`, etc.)
|
|
89
|
+
- Includes `.github` and `.vitepress` folders (not ignored like most configs)
|
|
90
|
+
|
|
91
|
+
See the [configuration examples below](#usage) for instructions on overriding these settings to match your team's
|
|
92
|
+
preferences.
|
|
93
|
+
|
|
51
94
|
## Installation
|
|
52
95
|
|
|
53
96
|
Install the package and required peer dependencies:
|
|
54
97
|
|
|
55
98
|
```sh
|
|
56
|
-
npm i -D eslint@
|
|
57
|
-
|
|
58
|
-
# Optionally, you can uninstall plugins or presets you don't need to manage anymore,
|
|
59
|
-
# @codfish/eslint-config includes them all.
|
|
60
|
-
npm uninstall typescript-eslint \
|
|
61
|
-
eslint-config-prettier \
|
|
62
|
-
eslint-plugin-jest \
|
|
63
|
-
eslint-plugin-jsx-a11y \
|
|
64
|
-
eslint-plugin-prettier \
|
|
65
|
-
eslint-plugin-react \
|
|
66
|
-
eslint-plugin-react-hooks \
|
|
67
|
-
@tanstack/eslint-plugin-query \
|
|
68
|
-
eslint-plugin-simple-import-sort \
|
|
69
|
-
eslint-plugin-testing-library \
|
|
70
|
-
eslint-plugin-yml \
|
|
71
|
-
@next/eslint-plugin-next \
|
|
72
|
-
eslint-plugin-next \
|
|
73
|
-
commitlint \
|
|
74
|
-
@commitlint/cli \
|
|
75
|
-
@commitlint/config-conventional \
|
|
76
|
-
prettier # optional, see note
|
|
99
|
+
npm i -D eslint@9 @codfish/eslint-config
|
|
77
100
|
```
|
|
78
101
|
|
|
79
|
-
> [!NOTE]
|
|
80
|
-
>
|
|
81
|
-
> ESLint now handles linting and formatting for JavaScript, TypeScript, Markdown, HTML, JSON, and YAML files
|
|
82
|
-
> automatically. If you want to format additional file types (like CSS, SCSS, etc.), you can leave Prettier installed as
|
|
83
|
-
> a dev dependency in your project.
|
|
84
|
-
|
|
85
102
|
## Usage
|
|
86
103
|
|
|
87
104
|
Create an `eslint.config.js` file in your project root:
|
|
@@ -107,41 +124,7 @@ export default defineConfig(
|
|
|
107
124
|
> [!IMPORTANT] If you get ES module errors, you may need to set the `type` field in your `package.json` to `module` or
|
|
108
125
|
> rename your config file to `eslint.config.mjs`.
|
|
109
126
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
```js
|
|
113
|
-
import codfish from '@codfish/eslint-config';
|
|
114
|
-
|
|
115
|
-
export default defineConfig({
|
|
116
|
-
extends: [codfish],
|
|
117
|
-
rules: {
|
|
118
|
-
// temporary
|
|
119
|
-
'@typescript-eslint/no-explicit-any': 'off',
|
|
120
|
-
},
|
|
121
|
-
});
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
**Using extends and targetting specific files:**
|
|
125
|
-
|
|
126
|
-
> [!WARNING]
|
|
127
|
-
>
|
|
128
|
-
> **Not recommended.** This will prevent it from using the `files` specified in the main config, so rules around test
|
|
129
|
-
> files, yml files, etc. will not be applied.
|
|
130
|
-
|
|
131
|
-
```js
|
|
132
|
-
import codfish from '@codfish/eslint-config';
|
|
133
|
-
|
|
134
|
-
export default defineConfig({
|
|
135
|
-
files: ['**/*.{js,jsx,ts,tsx}'],
|
|
136
|
-
extends: [codfish],
|
|
137
|
-
rules: {
|
|
138
|
-
// temporary
|
|
139
|
-
'@typescript-eslint/no-explicit-any': 'off',
|
|
140
|
-
},
|
|
141
|
-
});
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
**Not using the `defineConfig` function, just spread the config object:**
|
|
127
|
+
Not using the `defineConfig` function, just spread the config object:
|
|
145
128
|
|
|
146
129
|
```js
|
|
147
130
|
import codfish from '@codfish/eslint-config';
|
|
@@ -177,11 +160,6 @@ import codfish from '@codfish/eslint-config';
|
|
|
177
160
|
export default defineConfig(
|
|
178
161
|
codfish,
|
|
179
162
|
|
|
180
|
-
// Custom ignores
|
|
181
|
-
{
|
|
182
|
-
ignores: ['some-directory'],
|
|
183
|
-
},
|
|
184
|
-
|
|
185
163
|
{
|
|
186
164
|
files: ['**/*.spec.{js,ts,jsx,tsx}'],
|
|
187
165
|
rules: {
|
|
@@ -203,6 +181,9 @@ export default defineConfig(
|
|
|
203
181
|
{
|
|
204
182
|
files: ['**/*.{js,jsx,ts,tsx}'],
|
|
205
183
|
rules: {
|
|
184
|
+
// Customize Tailwind CSS rules
|
|
185
|
+
'tailwindcss/classnames-order': 'warn',
|
|
186
|
+
'tailwindcss/no-custom-classname': 'off',
|
|
206
187
|
// Customize Next.js rules
|
|
207
188
|
'@next/next/no-img-element': 'warn',
|
|
208
189
|
'@next/next/no-html-link-for-pages': 'off',
|
|
@@ -211,7 +192,7 @@ export default defineConfig(
|
|
|
211
192
|
);
|
|
212
193
|
```
|
|
213
194
|
|
|
214
|
-
|
|
195
|
+
### Docker Configuration
|
|
215
196
|
|
|
216
197
|
For projects leveraging Docker containers, you may want to disable import resolution errors for `node_modules` if
|
|
217
198
|
packages are only available in the container but you're running the linter locally.
|
|
@@ -230,24 +211,17 @@ export default defineConfig(
|
|
|
230
211
|
);
|
|
231
212
|
```
|
|
232
213
|
|
|
233
|
-
|
|
214
|
+
### dApps Configuration
|
|
234
215
|
|
|
235
216
|
For decentralized applications that use build artifacts and blockchain globals, use the specialized dApp config. This
|
|
236
217
|
config will set some globals as well as ignore missing build artifact imports. While you obviously need those to run
|
|
237
218
|
your app, sometimes you might want to run the linter in a ci/cd environment and build artifacts might not be present.
|
|
238
219
|
|
|
239
|
-
|
|
240
|
-
import codfish from '@codfish/eslint-config';
|
|
241
|
-
import dapp from '@codfish/eslint-config/dapp';
|
|
242
|
-
|
|
243
|
-
export default defineConfig(
|
|
244
|
-
codfish,
|
|
245
|
-
dapp,
|
|
220
|
+
You can also directly import the Prettier config:
|
|
246
221
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
);
|
|
222
|
+
```js
|
|
223
|
+
import prettierConfig from '@codfish/eslint-config/prettier';
|
|
224
|
+
export default prettierConfig;
|
|
251
225
|
```
|
|
252
226
|
|
|
253
227
|
The dApp configuration provides:
|
|
@@ -256,80 +230,19 @@ The dApp configuration provides:
|
|
|
256
230
|
- Import resolution handling for smart contract build artifacts
|
|
257
231
|
- Relaxed rules for generated contract files
|
|
258
232
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
This configuration includes some opinionated settings that you might want to customize for your project:
|
|
262
|
-
|
|
263
|
-
**Prettier/Formatting:**
|
|
264
|
-
|
|
265
|
-
- **Semicolons**: Enforces semicolons (`;`)
|
|
266
|
-
- **120 character line width**: Wider than the common 80/100 - you might prefer shorter lines
|
|
267
|
-
- **2-space indentation**: Uses 2 spaces for tabs
|
|
268
|
-
- **Single quotes**: Prefers `'single'` over `"double"` quotes
|
|
269
|
-
- **Trailing commas**: Adds trailing commas everywhere
|
|
270
|
-
- **Arrow parentheses**: Avoids parens around single args (`x => x` not `(x) => x`)
|
|
271
|
-
|
|
272
|
-
**ESLint Rules:**
|
|
273
|
-
|
|
274
|
-
- **Import sorting**: Enforces automatic import organization with specific grouping rules
|
|
275
|
-
- **Lodash restrictions**: Requires direct imports (`import get from 'lodash-es/get'`) instead of full lodash
|
|
276
|
-
- **React hooks deps**: Disables `exhaustive-deps` rule - you might want this stricter
|
|
277
|
-
- **Console statements**: Disallows `console.log` in regular code (only allowed in test files) - some teams prefer
|
|
278
|
-
warnings instead of errors
|
|
279
|
-
- **Next.js rules**: Enforces Next.js best practices and Core Web Vitals optimization
|
|
280
|
-
- **Testing Library rules**: Enforces Testing Library best practices in test files
|
|
281
|
-
|
|
282
|
-
**File Ignores:**
|
|
283
|
-
|
|
284
|
-
- Ignores common build directories (`.next`, `coverage`, `.vercel`, etc.)
|
|
285
|
-
- Includes `.github` and `.vitepress` folders (not ignored like most configs)
|
|
286
|
-
|
|
287
|
-
See the [configuration examples below](#usage) for instructions on overriding these settings to match your team's
|
|
288
|
-
preferences.
|
|
289
|
-
|
|
290
|
-
## IDE Setup
|
|
291
|
-
|
|
292
|
-
### VS Code / Cursor
|
|
233
|
+
## Prettier Configuration
|
|
293
234
|
|
|
294
|
-
|
|
295
|
-
[
|
|
296
|
-
auto-fix on save:
|
|
235
|
+
**Prettier is included and runs automatically** through ESLint for JavaScript, TypeScript, JSX, and TSX files using the
|
|
236
|
+
[built-in configuration](./prettier.js). **You don't need to install or configure Prettier separately** for basic usage.
|
|
297
237
|
|
|
298
|
-
|
|
238
|
+
However, if you want to format other file types (like Markdown, JSON, CSS, or YAML) or run Prettier directly, you can
|
|
239
|
+
install it as a dev dependency:
|
|
299
240
|
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
"editor.codeActionsOnSave": {
|
|
303
|
-
"source.fixAll": "explicit"
|
|
304
|
-
},
|
|
305
|
-
"eslint.validate": [
|
|
306
|
-
"javascript",
|
|
307
|
-
"javascriptreact",
|
|
308
|
-
"typescript",
|
|
309
|
-
"typescriptreact",
|
|
310
|
-
"markdown",
|
|
311
|
-
"json",
|
|
312
|
-
"jsonc",
|
|
313
|
-
"html",
|
|
314
|
-
"yml",
|
|
315
|
-
"yaml"
|
|
316
|
-
]
|
|
317
|
-
}
|
|
241
|
+
```sh
|
|
242
|
+
npm i -D prettier
|
|
318
243
|
```
|
|
319
244
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
- Automatic linting and formatting on save for all supported file types
|
|
323
|
-
- ESLint validation for Markdown, JSON, YAML, and HTML files
|
|
324
|
-
- A unified development experience across your entire codebase
|
|
325
|
-
|
|
326
|
-
## Prettier Configuration
|
|
327
|
-
|
|
328
|
-
**Prettier is included and runs automatically** through ESLint for JavaScript, TypeScript, JSX, TSX, Markdown, HTML,
|
|
329
|
-
JSON, and YAML files using the [built-in configuration](./prettier.js). **You don't need to install or configure
|
|
330
|
-
Prettier separately** for these file types.
|
|
331
|
-
|
|
332
|
-
You can then override the default config by creating your own Prettier config file, or extend the built-in config:
|
|
245
|
+
You can then override the defaults by creating your own Prettier config file, or extend the built-in config:
|
|
333
246
|
|
|
334
247
|
**Option 1: Extend the built-in config (Recommended)**
|
|
335
248
|
|
|
@@ -380,31 +293,11 @@ export default {
|
|
|
380
293
|
};
|
|
381
294
|
```
|
|
382
295
|
|
|
383
|
-
### Use in combination with prettier-plugin-tailwindcss
|
|
384
|
-
|
|
385
|
-
```sh
|
|
386
|
-
npm i -D eslint@10 @codfish/eslint-config prettier-plugin-tailwindcss
|
|
387
|
-
```
|
|
388
|
-
|
|
389
|
-
```js
|
|
390
|
-
// prettier.config.js
|
|
391
|
-
|
|
392
|
-
import codfish from '@codfish/eslint-config/prettier';
|
|
393
|
-
|
|
394
|
-
/** @type {import('prettier').Config & import('prettier-plugin-tailwindcss').PluginOptions} */
|
|
395
|
-
export default {
|
|
396
|
-
...codfish,
|
|
397
|
-
plugins: ['prettier-plugin-tailwindcss'],
|
|
398
|
-
tailwindStylesheet: './src/styles/app.css',
|
|
399
|
-
tailwindFunctions: ['clsx'], // optional
|
|
400
|
-
};
|
|
401
|
-
```
|
|
402
|
-
|
|
403
296
|
## Example scripts
|
|
404
297
|
|
|
405
298
|
Optionally, you can add these scripts to your `package.json` for common linting workflows:
|
|
406
299
|
|
|
407
|
-
**
|
|
300
|
+
**Basic scripts (no separate Prettier installation needed):**
|
|
408
301
|
|
|
409
302
|
```json
|
|
410
303
|
{
|
|
@@ -413,32 +306,24 @@ Optionally, you can add these scripts to your `package.json` for common linting
|
|
|
413
306
|
"fix": "eslint . --fix"
|
|
414
307
|
},
|
|
415
308
|
"lint-staged": {
|
|
416
|
-
"*.{js,jsx,ts,tsx
|
|
309
|
+
"*.{js,jsx,ts,tsx}": ["eslint --fix"]
|
|
417
310
|
}
|
|
418
311
|
}
|
|
419
312
|
```
|
|
420
313
|
|
|
421
|
-
|
|
422
|
-
>
|
|
423
|
-
> ESLint now handles linting and formatting for JavaScript, TypeScript, Markdown, HTML, JSON, and YAML files. You don't
|
|
424
|
-
> need to run Prettier separately for these file types.
|
|
425
|
-
|
|
426
|
-
**With Prettier for other file types (CSS, SCSS, etc.):**
|
|
427
|
-
|
|
428
|
-
If you want to format additional file types not covered by ESLint (like CSS, SCSS), you can install Prettier and add
|
|
429
|
-
these scripts:
|
|
314
|
+
**With Prettier installed separately (for formatting non-JS files):**
|
|
430
315
|
|
|
431
316
|
```json
|
|
432
317
|
{
|
|
433
318
|
"scripts": {
|
|
434
319
|
"lint": "eslint .",
|
|
435
320
|
"fix": "eslint . --fix",
|
|
436
|
-
"format": "prettier --write \"**/*.{css,
|
|
321
|
+
"format": "prettier --config ./node_modules/@codfish/eslint-config/prettier.js --write \"**/*.{json,css,md}\"",
|
|
437
322
|
"check": "npm run lint && npm run format -- --check --no-write"
|
|
438
323
|
},
|
|
439
324
|
"lint-staged": {
|
|
440
|
-
"*.{js,jsx,ts,tsx
|
|
441
|
-
"*.{css,
|
|
325
|
+
"*.{js,jsx,ts,tsx}": ["eslint --fix"],
|
|
326
|
+
"*.{json,css,md}": ["prettier --write --config ./node_modules/@codfish/eslint-config/prettier.js"]
|
|
442
327
|
}
|
|
443
328
|
}
|
|
444
329
|
```
|
|
@@ -505,72 +390,23 @@ jobs:
|
|
|
505
390
|
--verbose
|
|
506
391
|
```
|
|
507
392
|
|
|
508
|
-
##
|
|
509
|
-
|
|
510
|
-
This package now requires **ESLint 10.0.0 or higher** and **Node.js v20.19.0 or higher**.
|
|
511
|
-
|
|
512
|
-
### Breaking Changes in ESLint 10
|
|
513
|
-
|
|
514
|
-
- **ESLint 10 Required**: Minimum ESLint version is now 10.0.0
|
|
515
|
-
- **Node.js v20.19.0+**: Minimum Node.js version increased from v20.0.0 to v20.19.0
|
|
516
|
-
- **Legacy eslintrc removed**: ESLint 10 completely removes the deprecated eslintrc config system (this package already
|
|
517
|
-
uses flat config)
|
|
518
|
-
- **Improved JSX tracking**: ESLint 10 properly tracks JSX references in scope analysis, which may surface previously
|
|
519
|
-
hidden unused import warnings in React files
|
|
520
|
-
- **New recommended rules**: Three new rules enabled in `eslint:recommended`:
|
|
521
|
-
- `no-unassigned-vars` - Disallow variables that are assigned but never used
|
|
522
|
-
- `no-useless-assignment` - Disallow assignments that don't change the value
|
|
523
|
-
- `preserve-caught-error` - Enforce that caught errors are not reassigned
|
|
524
|
-
|
|
525
|
-
### Migration Steps
|
|
526
|
-
|
|
527
|
-
1. **Update Node.js** (if needed):
|
|
528
|
-
|
|
529
|
-
```sh
|
|
530
|
-
node --version # Ensure you're on v20.19.0+ or v22.13.0+
|
|
531
|
-
```
|
|
393
|
+
## Known issues
|
|
532
394
|
|
|
533
|
-
|
|
395
|
+
> https://github.com/francoismassart/eslint-plugin-tailwindcss/issues/149
|
|
534
396
|
|
|
535
|
-
|
|
536
|
-
npm install --save-dev eslint@10 @codfish/eslint-config@latest
|
|
537
|
-
```
|
|
397
|
+
When building dynamic classes, the auto sorting of tailwind classes can break things so beware.
|
|
538
398
|
|
|
539
|
-
|
|
399
|
+
To avoid this happening you can re-wrap the dynamic class expression like so:
|
|
540
400
|
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
This is necessary because some ESLint plugins haven't updated their `peerDependencies` to include ESLint 10 yet. The
|
|
546
|
-
plugins still work correctly with ESLint 10.
|
|
547
|
-
|
|
548
|
-
4. **Run linting** and check for new violations:
|
|
549
|
-
|
|
550
|
-
```sh
|
|
551
|
-
npm run lint
|
|
552
|
-
```
|
|
553
|
-
|
|
554
|
-
5. **Review React files** for newly reported unused imports. ESLint 10's improved JSX tracking may flag imports that
|
|
555
|
-
were previously ignored but are actually used in JSX.
|
|
556
|
-
|
|
557
|
-
### What Changed
|
|
558
|
-
|
|
559
|
-
Since this package already uses ESLint's flat config format (the biggest change in ESLint 9), the upgrade to ESLint 10
|
|
560
|
-
is relatively smooth. The main changes are:
|
|
561
|
-
|
|
562
|
-
- ✅ Flat config format (already implemented)
|
|
563
|
-
- ✅ Plugin configurations updated to ESLint 10-compatible versions
|
|
564
|
-
- ✅ All tests passing with ESLint 10
|
|
565
|
-
- ⚠️ Some plugins show peer dependency warnings but work correctly (ecosystem is catching up)
|
|
566
|
-
|
|
567
|
-
For more details, see the [ESLint 10 Migration Guide](https://eslint.org/docs/latest/use/migrate-to-10.0.0).
|
|
401
|
+
```vue-html
|
|
402
|
+
class="`p-0 ${`tw-border-${accentColor}`}`"
|
|
403
|
+
```
|
|
568
404
|
|
|
569
405
|
## Migration from Legacy Config
|
|
570
406
|
|
|
571
407
|
If you're upgrading from an older version that used Airbnb presets:
|
|
572
408
|
|
|
573
|
-
1. **Update to ESLint
|
|
409
|
+
1. **Update to ESLint v9+**: `npm install --save-dev eslint@9`
|
|
574
410
|
2. **Switch to flat config**: Replace `.eslintrc.js` with `eslint.config.js`
|
|
575
411
|
3. **Use import syntax**: Change from `require()` to `import` statements
|
|
576
412
|
4. **Remove explicit React config**: React support is now automatically detected
|
package/dist/dapp.d.ts
CHANGED
package/dist/docker.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jest.d.ts","sourceRoot":"","sources":["../../rules/jest.js"],"names":[],"mappings":""}
|
package/dist/rules/react.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vitest.d.ts","sourceRoot":"","sources":["../../rules/vitest.js"],"names":[],"mappings":""}
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get the version of a dependency from the consumer's package.json.
|
|
3
|
-
* Returns the major version as a string (e.g. '18', '19'), or null if not found.
|
|
4
|
-
*/
|
|
5
|
-
export function getDepVersion(dep: any): string | null;
|
|
6
1
|
export function hasLocalConfig(moduleName: any, searchOptions?: {}): boolean;
|
|
7
2
|
export function hasDep(props: any): boolean;
|
|
8
3
|
export function hasDevDep(props: any): boolean;
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../utils.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../utils.js"],"names":[],"mappings":"AA4BA,6EAKC;AAfgC,4CAA+D;AAA/D,+CAA+D;AAA/D,gDAA+D;AAMzF,8CAA8E;AAE9E,yDAAmE"}
|