@codfish/eslint-config 0.0.0-PR-155--2a9a213 → 0.0.0-PR-124--8ec70e4
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 -254
- 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)
|
|
@@ -9,79 +9,94 @@
|
|
|
9
9
|
[](https://github.com/semantic-release/semantic-release)
|
|
10
10
|
[](http://commitizen.github.io/cz-cli/)
|
|
11
11
|
|
|
12
|
-
<!-- prettier-ignore-start -->
|
|
13
12
|
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
|
14
13
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
15
14
|
## Table of Contents
|
|
16
15
|
|
|
17
16
|
- [Features](#features)
|
|
17
|
+
- [Automatic Configuration](#automatic-configuration)
|
|
18
|
+
- [Opinionated Highlights](#opinionated-highlights)
|
|
18
19
|
- [Installation](#installation)
|
|
19
20
|
- [Usage](#usage)
|
|
20
|
-
- [
|
|
21
|
-
- [
|
|
22
|
-
- [VS Code / Cursor](#vs-code--cursor)
|
|
21
|
+
- [Docker Configuration](#docker-configuration)
|
|
22
|
+
- [dApps Configuration](#dapps-configuration)
|
|
23
23
|
- [Prettier Configuration](#prettier-configuration)
|
|
24
|
-
- [Use in combination with prettier-plugin-tailwindcss](#use-in-combination-with-prettier-plugin-tailwindcss)
|
|
25
24
|
- [Example scripts](#example-scripts)
|
|
26
25
|
- [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)
|
|
26
|
+
- [Known issues](#known-issues)
|
|
31
27
|
- [Migration from Legacy Config](#migration-from-legacy-config)
|
|
32
28
|
|
|
33
29
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
34
|
-
<!-- prettier-ignore-end -->
|
|
35
30
|
|
|
36
31
|
## Features
|
|
37
32
|
|
|
38
|
-
- **Modern ESLint
|
|
33
|
+
- **Modern ESLint v9+ flat config**: Uses the new flat configuration format
|
|
39
34
|
- **Dynamic feature detection**: Automatically configures based on your project's dependencies
|
|
40
35
|
- **TypeScript support**: Full TypeScript linting with modern typescript-eslint parser and rules
|
|
41
36
|
- **React ecosystem**: React, React Hooks, and JSX accessibility rules when React is detected
|
|
42
37
|
- **Next.js support**: Automatically configures Next.js official plugin linting rules when detected
|
|
43
38
|
- **Test framework agnostic**: Supports Jest and Vitest with automatic detection
|
|
44
39
|
- **Testing Library integration**: Automatically includes Testing Library rules for test files
|
|
45
|
-
- **
|
|
40
|
+
- **Tailwind CSS support**: Automatically configures Tailwind CSS linting when detected
|
|
41
|
+
- **YAML/YML support**: Built-in linting for YAML configuration files
|
|
46
42
|
- **Prettier integration**: Built-in Prettier configuration with conflict resolution via eslint-config-prettier
|
|
47
43
|
- **ESM architecture**: Built with ECMAScript modules and full TypeScript typing
|
|
48
44
|
- **Docker support**: Optional configuration for dockerized applications
|
|
49
45
|
- **Blockchain/dApp support**: Optional configuration for decentralized applications
|
|
50
46
|
|
|
47
|
+
### Automatic Configuration
|
|
48
|
+
|
|
49
|
+
The config automatically detects and configures:
|
|
50
|
+
|
|
51
|
+
- **React**: Includes React, React Hooks, and JSX a11y rules when `react` is installed
|
|
52
|
+
- **Next.js**: Includes Next.js recommended and Core Web Vitals rules when `next` is detected
|
|
53
|
+
- **Jest**: Configures Jest-specific rules when `jest` is found in dependencies
|
|
54
|
+
- **Vitest**: Configures Vitest-specific rules when `vitest` is detected
|
|
55
|
+
- **Testing Library**: Automatically adds Testing Library rules for test files in Jest/Vitest projects
|
|
56
|
+
- **Tailwind CSS**: Includes Tailwind CSS linting rules when `tailwindcss` is detected
|
|
57
|
+
- **YAML files**: Always includes YAML/YML file linting support
|
|
58
|
+
- **Prettier**: Loads your project's Prettier config or falls back to [my defaults](./prettier.js)
|
|
59
|
+
|
|
60
|
+
### Opinionated Highlights
|
|
61
|
+
|
|
62
|
+
This configuration includes some opinionated settings that you might want to customize for your project:
|
|
63
|
+
|
|
64
|
+
**Prettier/Formatting:**
|
|
65
|
+
|
|
66
|
+
- **Semicolons**: Enforces semicolons (`;`)
|
|
67
|
+
- **120 character line width**: Wider than the common 80/100 - you might prefer shorter lines
|
|
68
|
+
- **2-space indentation**: Uses 2 spaces for tabs
|
|
69
|
+
- **Single quotes**: Prefers `'single'` over `"double"` quotes
|
|
70
|
+
- **Trailing commas**: Adds trailing commas everywhere
|
|
71
|
+
- **Arrow parentheses**: Avoids parens around single args (`x => x` not `(x) => x`)
|
|
72
|
+
|
|
73
|
+
**ESLint Rules:**
|
|
74
|
+
|
|
75
|
+
- **Import sorting**: Enforces automatic import organization with specific grouping rules
|
|
76
|
+
- **Lodash restrictions**: Requires direct imports (`import get from 'lodash-es/get'`) instead of full lodash
|
|
77
|
+
- **React hooks deps**: Disables `exhaustive-deps` rule - you might want this stricter
|
|
78
|
+
- **Console statements**: Disallows `console.log` in regular code (only allowed in test files) - some teams prefer
|
|
79
|
+
warnings instead of errors
|
|
80
|
+
- **Next.js rules**: Enforces Next.js best practices and Core Web Vitals optimization
|
|
81
|
+
- **Tailwind class sorting**: Automatically sorts Tailwind classes (can break dynamic class builds - see Known Issues)
|
|
82
|
+
- **Testing Library rules**: Enforces Testing Library best practices in test files
|
|
83
|
+
|
|
84
|
+
**File Ignores:**
|
|
85
|
+
|
|
86
|
+
- Ignores common build directories (`.next`, `coverage`, `.vercel`, etc.)
|
|
87
|
+
- Includes `.github` and `.vitepress` folders (not ignored like most configs)
|
|
88
|
+
|
|
89
|
+
See the [configuration examples below](#usage) for instructions on overriding these settings to match your team's
|
|
90
|
+
preferences.
|
|
91
|
+
|
|
51
92
|
## Installation
|
|
52
93
|
|
|
53
94
|
Install the package and required peer dependencies:
|
|
54
95
|
|
|
55
96
|
```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
|
|
97
|
+
npm i -D eslint@9 @codfish/eslint-config
|
|
77
98
|
```
|
|
78
99
|
|
|
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
100
|
## Usage
|
|
86
101
|
|
|
87
102
|
Create an `eslint.config.js` file in your project root:
|
|
@@ -107,41 +122,7 @@ export default defineConfig(
|
|
|
107
122
|
> [!IMPORTANT] If you get ES module errors, you may need to set the `type` field in your `package.json` to `module` or
|
|
108
123
|
> rename your config file to `eslint.config.mjs`.
|
|
109
124
|
|
|
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:**
|
|
125
|
+
Not using the `defineConfig` function, just spread the config object:
|
|
145
126
|
|
|
146
127
|
```js
|
|
147
128
|
import codfish from '@codfish/eslint-config';
|
|
@@ -177,11 +158,6 @@ import codfish from '@codfish/eslint-config';
|
|
|
177
158
|
export default defineConfig(
|
|
178
159
|
codfish,
|
|
179
160
|
|
|
180
|
-
// Custom ignores
|
|
181
|
-
{
|
|
182
|
-
ignores: ['some-directory'],
|
|
183
|
-
},
|
|
184
|
-
|
|
185
161
|
{
|
|
186
162
|
files: ['**/*.spec.{js,ts,jsx,tsx}'],
|
|
187
163
|
rules: {
|
|
@@ -203,6 +179,9 @@ export default defineConfig(
|
|
|
203
179
|
{
|
|
204
180
|
files: ['**/*.{js,jsx,ts,tsx}'],
|
|
205
181
|
rules: {
|
|
182
|
+
// Customize Tailwind CSS rules
|
|
183
|
+
'tailwindcss/classnames-order': 'warn',
|
|
184
|
+
'tailwindcss/no-custom-classname': 'off',
|
|
206
185
|
// Customize Next.js rules
|
|
207
186
|
'@next/next/no-img-element': 'warn',
|
|
208
187
|
'@next/next/no-html-link-for-pages': 'off',
|
|
@@ -211,7 +190,7 @@ export default defineConfig(
|
|
|
211
190
|
);
|
|
212
191
|
```
|
|
213
192
|
|
|
214
|
-
|
|
193
|
+
### Docker Configuration
|
|
215
194
|
|
|
216
195
|
For projects leveraging Docker containers, you may want to disable import resolution errors for `node_modules` if
|
|
217
196
|
packages are only available in the container but you're running the linter locally.
|
|
@@ -230,24 +209,17 @@ export default defineConfig(
|
|
|
230
209
|
);
|
|
231
210
|
```
|
|
232
211
|
|
|
233
|
-
|
|
212
|
+
### dApps Configuration
|
|
234
213
|
|
|
235
214
|
For decentralized applications that use build artifacts and blockchain globals, use the specialized dApp config. This
|
|
236
215
|
config will set some globals as well as ignore missing build artifact imports. While you obviously need those to run
|
|
237
216
|
your app, sometimes you might want to run the linter in a ci/cd environment and build artifacts might not be present.
|
|
238
217
|
|
|
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,
|
|
218
|
+
You can also directly import the Prettier config:
|
|
246
219
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
);
|
|
220
|
+
```js
|
|
221
|
+
import prettierConfig from '@codfish/eslint-config/prettier';
|
|
222
|
+
export default prettierConfig;
|
|
251
223
|
```
|
|
252
224
|
|
|
253
225
|
The dApp configuration provides:
|
|
@@ -256,80 +228,19 @@ The dApp configuration provides:
|
|
|
256
228
|
- Import resolution handling for smart contract build artifacts
|
|
257
229
|
- Relaxed rules for generated contract files
|
|
258
230
|
|
|
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
|
|
231
|
+
## Prettier Configuration
|
|
293
232
|
|
|
294
|
-
|
|
295
|
-
[
|
|
296
|
-
auto-fix on save:
|
|
233
|
+
**Prettier is included and runs automatically** through ESLint for JavaScript, TypeScript, JSX, and TSX files using the
|
|
234
|
+
[built-in configuration](./prettier.js). **You don't need to install or configure Prettier separately** for basic usage.
|
|
297
235
|
|
|
298
|
-
|
|
236
|
+
However, if you want to format other file types (like Markdown, JSON, CSS, or YAML) or run Prettier directly, you can
|
|
237
|
+
install it as a dev dependency:
|
|
299
238
|
|
|
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
|
-
}
|
|
239
|
+
```sh
|
|
240
|
+
npm i -D prettier
|
|
318
241
|
```
|
|
319
242
|
|
|
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:
|
|
243
|
+
You can then override the defaults by creating your own Prettier config file, or extend the built-in config:
|
|
333
244
|
|
|
334
245
|
**Option 1: Extend the built-in config (Recommended)**
|
|
335
246
|
|
|
@@ -380,31 +291,11 @@ export default {
|
|
|
380
291
|
};
|
|
381
292
|
```
|
|
382
293
|
|
|
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
294
|
## Example scripts
|
|
404
295
|
|
|
405
296
|
Optionally, you can add these scripts to your `package.json` for common linting workflows:
|
|
406
297
|
|
|
407
|
-
**
|
|
298
|
+
**Basic scripts (no separate Prettier installation needed):**
|
|
408
299
|
|
|
409
300
|
```json
|
|
410
301
|
{
|
|
@@ -413,32 +304,24 @@ Optionally, you can add these scripts to your `package.json` for common linting
|
|
|
413
304
|
"fix": "eslint . --fix"
|
|
414
305
|
},
|
|
415
306
|
"lint-staged": {
|
|
416
|
-
"*.{js,jsx,ts,tsx
|
|
307
|
+
"*.{js,jsx,ts,tsx}": ["eslint --fix"]
|
|
417
308
|
}
|
|
418
309
|
}
|
|
419
310
|
```
|
|
420
311
|
|
|
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:
|
|
312
|
+
**With Prettier installed separately (for formatting non-JS files):**
|
|
430
313
|
|
|
431
314
|
```json
|
|
432
315
|
{
|
|
433
316
|
"scripts": {
|
|
434
317
|
"lint": "eslint .",
|
|
435
318
|
"fix": "eslint . --fix",
|
|
436
|
-
"format": "prettier --write \"**/*.{css,
|
|
319
|
+
"format": "prettier --config ./node_modules/@codfish/eslint-config/prettier.js --write \"**/*.{json,css,md}\"",
|
|
437
320
|
"check": "npm run lint && npm run format -- --check --no-write"
|
|
438
321
|
},
|
|
439
322
|
"lint-staged": {
|
|
440
|
-
"*.{js,jsx,ts,tsx
|
|
441
|
-
"*.{css,
|
|
323
|
+
"*.{js,jsx,ts,tsx}": ["eslint --fix"],
|
|
324
|
+
"*.{json,css,md}": ["prettier --write --config ./node_modules/@codfish/eslint-config/prettier.js"]
|
|
442
325
|
}
|
|
443
326
|
}
|
|
444
327
|
```
|
|
@@ -505,72 +388,23 @@ jobs:
|
|
|
505
388
|
--verbose
|
|
506
389
|
```
|
|
507
390
|
|
|
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
|
-
```
|
|
391
|
+
## Known issues
|
|
532
392
|
|
|
533
|
-
|
|
393
|
+
> https://github.com/francoismassart/eslint-plugin-tailwindcss/issues/149
|
|
534
394
|
|
|
535
|
-
|
|
536
|
-
npm install --save-dev eslint@10 @codfish/eslint-config@latest
|
|
537
|
-
```
|
|
395
|
+
When building dynamic classes, the auto sorting of tailwind classes can break things so beware.
|
|
538
396
|
|
|
539
|
-
|
|
397
|
+
To avoid this happening you can re-wrap the dynamic class expression like so:
|
|
540
398
|
|
|
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).
|
|
399
|
+
```vue-html
|
|
400
|
+
class="`p-0 ${`tw-border-${accentColor}`}`"
|
|
401
|
+
```
|
|
568
402
|
|
|
569
403
|
## Migration from Legacy Config
|
|
570
404
|
|
|
571
405
|
If you're upgrading from an older version that used Airbnb presets:
|
|
572
406
|
|
|
573
|
-
1. **Update to ESLint
|
|
407
|
+
1. **Update to ESLint v9+**: `npm install --save-dev eslint@9`
|
|
574
408
|
2. **Switch to flat config**: Replace `.eslintrc.js` with `eslint.config.js`
|
|
575
409
|
3. **Use import syntax**: Change from `require()` to `import` statements
|
|
576
410
|
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"}
|