eslint-config-xo-next 0.2.1 → 0.2.3

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.
Files changed (3) hide show
  1. package/index.js +2 -1
  2. package/package.json +1 -1
  3. package/readme.md +51 -32
package/index.js CHANGED
@@ -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.2.1",
3
+ "version": "0.2.3",
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",
package/readme.md CHANGED
@@ -4,9 +4,12 @@ ESLint [shareable config](http://eslint.org/docs/developer-guide/shareable-confi
4
4
 
5
5
  ## Features
6
6
 
7
- - Eliminates ESLint plugin and parser conflicts from using ESLint 10 with `eslint-config-next` and `eslint-config-xo-react`
8
- - Combines Next.js's [`@next/next`](https://nextjs.org/docs/app/api-reference/config/eslint#rules) rules with `eslint-config-xo-react`'s stricter [`eslint-plugin-jsx-a11y-x`](https://github.com/es-tooling/eslint-plugin-jsx-a11y-x), [`@eslint-react/eslint-plugin`](https://github.com/Rel1cx/eslint-react), and [`eslint-plugin-react-hooks`](https://github.com/react/react/tree/HEAD/packages/eslint-plugin-react-hooks) rules
9
- - Supports Tailwind CSS syntax
7
+ - Eliminates conflicts between ESLint 10, `eslint-config-next`, `eslint-config-xo-react`, and `eslint-config-xo`
8
+ - 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))
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
12
+ - Supports Tailwind CSS
10
13
 
11
14
  ## Install
12
15
 
@@ -18,16 +21,14 @@ npm install --save-dev \
18
21
  eslint-config-xo-next
19
22
  ```
20
23
 
21
- `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
22
-
23
24
  ## Usage
24
25
 
25
26
  ```js
26
27
  // eslint.config.js
28
+ import {defineConfig} from 'eslint/config';
27
29
  import eslintConfigXo from 'eslint-config-xo';
28
30
  import eslintConfigXoNext from 'eslint-config-xo-next';
29
31
  import eslintConfigXoReact from 'eslint-config-xo-react';
30
- import {defineConfig} from 'eslint/config';
31
32
 
32
33
  export default defineConfig([
33
34
  ...eslintConfigXo(),
@@ -36,6 +37,29 @@ export default defineConfig([
36
37
  ]);
37
38
  ```
38
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
+
39
63
  ### Options
40
64
 
41
65
  #### config
@@ -43,10 +67,10 @@ export default defineConfig([
43
67
  Type: `'core-web-vitals' | 'recommended'`\
44
68
  Default: `'core-web-vitals'`
45
69
 
46
- Which of the [Next.js ESLint configurations](https://nextjs.org/docs/app/api-reference/config/eslint#setup-eslint) to use. See the [Next.js ESLint Plugin documentation](https://nextjs.org/docs/app/api-reference/config/eslint#setup-eslint) for more information.
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.
47
71
 
48
72
  ```js
49
- ...xoNext({config: 'recommended'})
73
+ eslintXoNext({config: 'recommended'})
50
74
  ```
51
75
 
52
76
  #### tailwind
@@ -56,7 +80,7 @@ Type: `3 | 4`
56
80
  Enable support for Tailwind CSS v3 or v4 syntax
57
81
 
58
82
  ```js
59
- ...xoNext({tailwind: 4})
83
+ eslintXoNext({tailwind: 4})
60
84
  ```
61
85
 
62
86
  #### rootDir
@@ -66,32 +90,27 @@ Type: `string | string[]`
66
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.
67
91
 
68
92
  ```js
69
- ...xoNext({rootDir: 'packages/my-app/'})
70
- ```
71
-
72
- ## Use with [XO](https://github.com/xojs/xo)
73
-
74
- ```sh
75
- npm install --save-dev \
76
- @next/eslint-plugin-next \
77
- eslint-config-xo-react \
78
- eslint-config-xo-next
93
+ eslintXoNext({rootDir: 'packages/my-app/'})
79
94
  ```
80
95
 
81
- ```js
82
- // xo.config.js
83
- import xoNext from 'eslint-config-xo-next';
84
- import xoReact from 'eslint-config-xo-react';
85
- import {defineConfig} from 'eslint/config';
96
+ ## Comparison
86
97
 
87
- const xoConfig = defineConfig([
88
- ...xoReact(),
89
- ...xoNext(),
90
- ]);
91
- ```
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`)
92
99
 
93
- ## FAQ
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** |
94
109
 
95
- ### How is this different from [eslint-config-xo-nextjs](https://github.com/tusbar/eslint-config-xo-nextjs)?
110
+ <details>
111
+ <summary>Comparison package versions</summary>
96
112
 
97
- This config acts as a minimal compatibility layer between Next.js's and XO's configs instead of wrapping them. With this config, you install your own version of `@next/eslint-plugin-next` so that its version matches your project's `next` and `@next/*` dependencies, and you install your own versions of `eslint-config-xo` (or `xo`) and `eslint-config-xo-react` so that you can update them without waiting for this plugin to update them.
113
+ - `eslint-config-next`: 16.3.6
114
+ - `eslint-config-xo-react`: 0.32.0
115
+ - `eslint-config-xo`: 4.0.1
116
+ </details>