eslint-config-xo-next 0.2.2 → 0.3.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/{index.js → config.js} +2 -1
- package/package.json +10 -10
- package/readme.md +50 -31
- /package/{index.d.ts → config.d.ts} +0 -0
package/{index.js → config.js}
RENAMED
|
@@ -12,7 +12,7 @@ export default function xoNext(options) {
|
|
|
12
12
|
const config = [
|
|
13
13
|
// Our own version of eslint-config-next's 'next' config object:
|
|
14
14
|
{
|
|
15
|
-
name: 'xo-next',
|
|
15
|
+
name: 'xo-next/base',
|
|
16
16
|
// Use next's files
|
|
17
17
|
files: ['**/*.{js,jsx,mjs,ts,tsx,mts,cts}'],
|
|
18
18
|
plugins: {
|
|
@@ -57,6 +57,7 @@ export default function xoNext(options) {
|
|
|
57
57
|
// Omit next's 'next/typescript' config object to use xo's TypeScript parsing
|
|
58
58
|
// Use next's ignores
|
|
59
59
|
{
|
|
60
|
+
name: 'xo-next/ignores',
|
|
60
61
|
ignores: ['.next/**', 'out/**', 'build/**', 'next-env.d.ts'],
|
|
61
62
|
},
|
|
62
63
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-xo-next",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "ESLint shareable config for Next.js to be used with eslint-config-xo-react",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "github:patrik-csak/eslint-config-xo-next",
|
|
@@ -8,27 +8,27 @@
|
|
|
8
8
|
"type": "module",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
-
"types": "./
|
|
12
|
-
"default": "./
|
|
11
|
+
"types": "./config.d.ts",
|
|
12
|
+
"default": "./config.js"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"sideEffects": false,
|
|
16
16
|
"engines": {
|
|
17
|
-
"node": "22 -
|
|
17
|
+
"node": "22 - 26"
|
|
18
18
|
},
|
|
19
19
|
"devEngines": {
|
|
20
20
|
"runtime": {
|
|
21
21
|
"name": "node",
|
|
22
|
-
"version": "
|
|
22
|
+
"version": "22 - 26"
|
|
23
23
|
},
|
|
24
24
|
"packageManager": {
|
|
25
25
|
"name": "npm",
|
|
26
|
-
"version": "
|
|
26
|
+
"version": "12"
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"build": "tsc",
|
|
31
|
-
"inspect": "eslint-config-inspector --config=
|
|
31
|
+
"inspect": "eslint-config-inspector --config=config.js",
|
|
32
32
|
"lint": "eslint",
|
|
33
33
|
"prepack": "npm run build",
|
|
34
34
|
"pretest": "npm run build",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"test:coverage": "npm run test -- --experimental-test-coverage"
|
|
37
37
|
},
|
|
38
38
|
"files": [
|
|
39
|
-
"
|
|
40
|
-
"
|
|
39
|
+
"config.js",
|
|
40
|
+
"config.d.ts"
|
|
41
41
|
],
|
|
42
42
|
"keywords": [
|
|
43
43
|
"eslint",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@tsconfig/strictest": "^2.0.8",
|
|
59
59
|
"@types/node": "^24.13.2",
|
|
60
60
|
"eslint": "^10.6.0",
|
|
61
|
-
"eslint-config-xo": "^
|
|
61
|
+
"eslint-config-xo": "^5.0.0",
|
|
62
62
|
"eslint-config-xo-react": "^0.32.0",
|
|
63
63
|
"typescript": "^6.0.3"
|
|
64
64
|
},
|
package/readme.md
CHANGED
|
@@ -4,12 +4,11 @@ ESLint [shareable config](http://eslint.org/docs/developer-guide/shareable-confi
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
- You can update `eslint-config-xo` and `eslint-config-xo-react` without waiting for this config to update
|
|
7
|
+
- Allows you to use [`eslint-config-next` rules](https://nextjs.org/docs/app/api-reference/config/eslint#rules) with the stricter React, hooks, accessibility, and TypeScript rules of `eslint-config-xo-react` and `eslint-config-xo` (see [comparison](#comparison))
|
|
8
|
+
- Eliminates conflicts between ESLint 10, `eslint-config-next`, `eslint-config-xo-react`, and `eslint-config-xo`. No need for `@eslint/compat`.
|
|
9
|
+
- Acts as a thin compatibility layer instead of depending on Next.js or XO packages
|
|
10
|
+
- Your app’s `@next/eslint-plugin-next` can be kept in sync with its `next` and other `@next/*` packages using `next upgrade` or `@next/codemod upgrade`
|
|
11
|
+
- You can update `eslint-config-xo-react` and `eslint-config-xo` without waiting for this config to update
|
|
13
12
|
- Supports Tailwind CSS
|
|
14
13
|
|
|
15
14
|
## Install
|
|
@@ -22,16 +21,14 @@ npm install --save-dev \
|
|
|
22
21
|
eslint-config-xo-next
|
|
23
22
|
```
|
|
24
23
|
|
|
25
|
-
`eslint-config-xo-next` requires you to install `@next/eslint-plugin-next` as a direct dependency so its version can be kept in sync with your app’s other Next.js dependencies
|
|
26
|
-
|
|
27
24
|
## Usage
|
|
28
25
|
|
|
29
26
|
```js
|
|
30
27
|
// eslint.config.js
|
|
28
|
+
import {defineConfig} from 'eslint/config';
|
|
31
29
|
import eslintConfigXo from 'eslint-config-xo';
|
|
32
30
|
import eslintConfigXoNext from 'eslint-config-xo-next';
|
|
33
31
|
import eslintConfigXoReact from 'eslint-config-xo-react';
|
|
34
|
-
import {defineConfig} from 'eslint/config';
|
|
35
32
|
|
|
36
33
|
export default defineConfig([
|
|
37
34
|
...eslintConfigXo(),
|
|
@@ -40,6 +37,29 @@ export default defineConfig([
|
|
|
40
37
|
]);
|
|
41
38
|
```
|
|
42
39
|
|
|
40
|
+
<details>
|
|
41
|
+
<summary>Use with <a href=https://github.com/xojs/xo>XO</a></summary>
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
npm install --save-dev \
|
|
45
|
+
@next/eslint-plugin-next \
|
|
46
|
+
eslint-config-xo-react \
|
|
47
|
+
eslint-config-xo-next
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```js
|
|
51
|
+
// xo.config.js
|
|
52
|
+
import {defineConfig} from 'eslint/config';
|
|
53
|
+
import eslintConfigXoNext from 'eslint-config-xo-next';
|
|
54
|
+
import eslintConfigXoReact from 'eslint-config-xo-react';
|
|
55
|
+
|
|
56
|
+
const xoConfig = defineConfig([
|
|
57
|
+
...eslintConfigXoReact(),
|
|
58
|
+
...eslintConfigXoNext(),
|
|
59
|
+
]);
|
|
60
|
+
```
|
|
61
|
+
</details>
|
|
62
|
+
|
|
43
63
|
### Options
|
|
44
64
|
|
|
45
65
|
#### config
|
|
@@ -47,10 +67,10 @@ export default defineConfig([
|
|
|
47
67
|
Type: `'core-web-vitals' | 'recommended'`\
|
|
48
68
|
Default: `'core-web-vitals'`
|
|
49
69
|
|
|
50
|
-
Which of the
|
|
70
|
+
Which of the Next.js ESLint configurations to use. See the [Next.js ESLint Plugin documentation](https://nextjs.org/docs/app/api-reference/config/eslint) for more information.
|
|
51
71
|
|
|
52
72
|
```js
|
|
53
|
-
|
|
73
|
+
eslintXoNext({config: 'recommended'})
|
|
54
74
|
```
|
|
55
75
|
|
|
56
76
|
#### tailwind
|
|
@@ -60,7 +80,7 @@ Type: `3 | 4`
|
|
|
60
80
|
Enable support for Tailwind CSS v3 or v4 syntax
|
|
61
81
|
|
|
62
82
|
```js
|
|
63
|
-
|
|
83
|
+
eslintXoNext({tailwind: 4})
|
|
64
84
|
```
|
|
65
85
|
|
|
66
86
|
#### rootDir
|
|
@@ -70,28 +90,27 @@ Type: `string | string[]`
|
|
|
70
90
|
Where to find your Next.js application if Next.js isn’t installed in your root directory. See the [Next.js ESLint Plugin documentation](https://nextjs.org/docs/app/api-reference/config/eslint#specifying-a-root-directory-within-a-monorepo) for more information.
|
|
71
91
|
|
|
72
92
|
```js
|
|
73
|
-
|
|
93
|
+
eslintXoNext({rootDir: 'packages/my-app/'})
|
|
74
94
|
```
|
|
75
95
|
|
|
76
|
-
##
|
|
96
|
+
## Comparison
|
|
77
97
|
|
|
78
|
-
|
|
79
|
-
npm install --save-dev \
|
|
80
|
-
@next/eslint-plugin-next \
|
|
81
|
-
eslint-config-xo-react \
|
|
82
|
-
eslint-config-xo-next
|
|
83
|
-
```
|
|
98
|
+
Below is a comparison of the plugins and enabled rule counts between `eslint-config-next` and `eslint-config-xo-react` (with `eslint-config-xo`)
|
|
84
99
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
100
|
+
| | `eslint-config-next` plugin | `eslint-config-next` rules | `eslint-config-xo-react` plugin | `eslint-config-xo-react` rules |
|
|
101
|
+
|---|---|--:|---|--:|
|
|
102
|
+
| **Next.js** | `@next/eslint-plugin-next` | 22 | `@next/eslint-plugin-next` | 22 |
|
|
103
|
+
| **React** | `eslint-plugin-react` (unmaintained) | 22 | **`@eslint-react/eslint-plugin`** | **69** |
|
|
104
|
+
| **Hooks** | `react-hooks` | 16 | `react-hooks` | **17** |
|
|
105
|
+
| **Accessibility** | `jsx-a11y` (unmaintained) | 6 | **`jsx-a11y-x`** | **28** |
|
|
106
|
+
| **TypeScript** | `@typescript-eslint` | 20 | `@typescript-eslint` | **94** |
|
|
107
|
+
| **Import** | `eslint-plugin-import` (unmaintained) | 1 | **`eslint-plugin-import-x`** | **23** |
|
|
108
|
+
| **Totals** | | 87 | | **253** |
|
|
90
109
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
...eslintConfigXoNext(),
|
|
94
|
-
]);
|
|
95
|
-
```
|
|
110
|
+
<details>
|
|
111
|
+
<summary>Comparison package versions</summary>
|
|
96
112
|
|
|
97
|
-
|
|
113
|
+
- `eslint-config-next`: 16.3.6
|
|
114
|
+
- `eslint-config-xo-react`: 0.32.0
|
|
115
|
+
- `eslint-config-xo`: 4.0.1
|
|
116
|
+
</details>
|
|
File without changes
|