@tommy-mitchell/eslint-config-xo 1.0.0-5 → 2.0.0-beta.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/package.json +17 -17
- package/readme.md +15 -6
- package/src/dprint.js +1 -0
- package/src/index.d.ts +2 -2
- package/src/next.js +4 -18
- package/src/react.js +9 -5
- package/src/tailwind.js +12 -13
- package/src/xo.js +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tommy-mitchell/eslint-config-xo",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.0",
|
|
4
4
|
"description": "Personal config for XO.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nodejs",
|
|
@@ -28,31 +28,31 @@
|
|
|
28
28
|
"test": "ava"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@eslint
|
|
32
|
-
"
|
|
31
|
+
"@next/eslint-plugin-next": "^16.0.5",
|
|
32
|
+
"eslint-plugin-better-tailwindcss": "^4.3.2",
|
|
33
33
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
34
|
-
"eslint-plugin-perfectionist": "^
|
|
35
|
-
"eslint-plugin-react-refresh": "^0.
|
|
36
|
-
"eslint-plugin-readable-tailwind": "^1.9.1",
|
|
34
|
+
"eslint-plugin-perfectionist": "^5.7.0",
|
|
35
|
+
"eslint-plugin-react-refresh": "^0.5.2",
|
|
37
36
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
38
|
-
"eslint-plugin-sort-react-dependency-arrays": "^1.0.0"
|
|
39
|
-
"eslint-plugin-tailwindcss": "^3.18.0"
|
|
37
|
+
"eslint-plugin-sort-react-dependency-arrays": "^1.0.0"
|
|
40
38
|
},
|
|
41
39
|
"devDependencies": {
|
|
42
|
-
"@stylistic/eslint-plugin": "^
|
|
43
|
-
"@tommy-mitchell/dprint-config": "
|
|
44
|
-
"ava": "^
|
|
40
|
+
"@stylistic/eslint-plugin": "^5.6.1",
|
|
41
|
+
"@tommy-mitchell/dprint-config": "0.6.0",
|
|
42
|
+
"ava": "^7.0.0",
|
|
45
43
|
"dprint": "0.x",
|
|
46
|
-
"eslint-plugin-react": "^7.37.
|
|
47
|
-
"execa": "^9.
|
|
44
|
+
"eslint-plugin-react": "^7.37.5",
|
|
45
|
+
"execa": "^9.6.0",
|
|
46
|
+
"react": "^19.2.0",
|
|
47
|
+
"tailwindcss": "^4.1.17",
|
|
48
48
|
"tempy": "^3.1.0",
|
|
49
|
-
"xo": "
|
|
49
|
+
"xo": "~2.0.2"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"dprint": "0.x",
|
|
53
53
|
"react": "19.x",
|
|
54
|
-
"tailwindcss": "
|
|
55
|
-
"xo": "
|
|
54
|
+
"tailwindcss": "4.x",
|
|
55
|
+
"xo": "2.x"
|
|
56
56
|
},
|
|
57
57
|
"peerDependenciesMeta": {
|
|
58
58
|
"dprint": {
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
68
|
"engines": {
|
|
69
|
-
"node": "
|
|
69
|
+
"node": ">=22"
|
|
70
70
|
},
|
|
71
71
|
"ava": {
|
|
72
72
|
"timeout": "30s"
|
package/readme.md
CHANGED
|
@@ -5,7 +5,7 @@ Personal config for [`XO`](https://github.com/xojs/xo). Recommended to be used w
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
|
-
npm install --save-dev @tommy-mitchell/eslint-config-xo
|
|
8
|
+
npm install --save-dev @tommy-mitchell/eslint-config-xo xo
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
<details>
|
|
@@ -13,7 +13,11 @@ npm install --save-dev @tommy-mitchell/eslint-config-xo@beta xo@npm:@spence-s/fl
|
|
|
13
13
|
<p>
|
|
14
14
|
|
|
15
15
|
```sh
|
|
16
|
-
yarn add --dev @tommy-mitchell/eslint-config-xo
|
|
16
|
+
yarn add --dev @tommy-mitchell/eslint-config-xo xo
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
pnpm add --save-dev @tommy-mitchell/eslint-config-xo xo
|
|
17
21
|
```
|
|
18
22
|
|
|
19
23
|
</p>
|
|
@@ -24,11 +28,15 @@ yarn add --dev @tommy-mitchell/eslint-config-xo@beta xo@npm:@spence-s/flat-xo@la
|
|
|
24
28
|
<p>
|
|
25
29
|
|
|
26
30
|
```sh
|
|
27
|
-
npm install --save-dev @tommy-mitchell/eslint-config-xo
|
|
31
|
+
npm install --save-dev @tommy-mitchell/eslint-config-xo xo @tommy-mitchell/dprint-config dprint
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
yarn add --dev @tommy-mitchell/eslint-config-xo xo @tommy-mitchell/dprint-config dprint
|
|
28
36
|
```
|
|
29
37
|
|
|
30
38
|
```sh
|
|
31
|
-
|
|
39
|
+
pnpm add --save-dev @tommy-mitchell/eslint-config-xo xo @tommy-mitchell/dprint-config dprint
|
|
32
40
|
```
|
|
33
41
|
|
|
34
42
|
</p>
|
|
@@ -47,11 +55,12 @@ yarn add --dev @tommy-mitchell/eslint-config-xo@beta xo@npm:@spence-s/flat-xo@la
|
|
|
47
55
|
// xo.config.js
|
|
48
56
|
import * as configs from "@tommy-mitchell/eslint-config-xo";
|
|
49
57
|
|
|
58
|
+
/** @type {import('xo').FlatXoConfig} */
|
|
50
59
|
export default [
|
|
51
60
|
...configs.xo,
|
|
52
|
-
...configs.react, // If using React
|
|
61
|
+
...configs.react({ version: "19" }), // If using React
|
|
53
62
|
...configs.next, // If using Next.js
|
|
54
|
-
...configs.tailwind, // If using
|
|
63
|
+
...configs.tailwind({ config: "src/tailwind.css" }), // If using TailwindCSS
|
|
55
64
|
...configs.dprint, // If using dprint (must be last to override stylistic rules)
|
|
56
65
|
// Plus any overrides
|
|
57
66
|
]
|
package/src/dprint.js
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ import type { FlatXoConfig } from "xo";
|
|
|
2
2
|
|
|
3
3
|
export declare const dprint: FlatXoConfig;
|
|
4
4
|
export declare const next: FlatXoConfig;
|
|
5
|
-
export declare const react: FlatXoConfig;
|
|
6
|
-
export declare const tailwind: FlatXoConfig;
|
|
5
|
+
export declare const react: (options?: { version?: string; }) => FlatXoConfig;
|
|
6
|
+
export declare const tailwind: ({ config }: { config: string; }) => FlatXoConfig;
|
|
7
7
|
export declare const xo: FlatXoConfig;
|
package/src/next.js
CHANGED
|
@@ -1,22 +1,8 @@
|
|
|
1
|
-
import { FlatCompat } from "@eslint/eslintrc";
|
|
2
1
|
import next from "@next/eslint-plugin-next";
|
|
2
|
+
import { reactRefresh } from "eslint-plugin-react-refresh";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
baseDirectory: import.meta.dirname,
|
|
6
|
-
});
|
|
7
|
-
|
|
4
|
+
/** @type {import('xo').FlatXoConfig} */
|
|
8
5
|
export default [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
files: "**/{layout,page}.{jsx,tsx}",
|
|
12
|
-
rules: {
|
|
13
|
-
"react-refresh/only-export-components": ["warn", {
|
|
14
|
-
allowConstantExport: true,
|
|
15
|
-
allowExportNames: [
|
|
16
|
-
"metadata",
|
|
17
|
-
"generateMetadata",
|
|
18
|
-
],
|
|
19
|
-
}],
|
|
20
|
-
},
|
|
21
|
-
},
|
|
6
|
+
next.configs["core-web-vitals"],
|
|
7
|
+
reactRefresh.configs.next,
|
|
22
8
|
];
|
package/src/react.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import jsxA11y from "eslint-plugin-jsx-a11y";
|
|
2
2
|
import react from "eslint-plugin-react";
|
|
3
|
-
import reactRefresh from "eslint-plugin-react-refresh";
|
|
3
|
+
import { reactRefresh } from "eslint-plugin-react-refresh";
|
|
4
4
|
import sortReactDependencyArrays from "eslint-plugin-sort-react-dependency-arrays";
|
|
5
5
|
|
|
6
6
|
const configs = [
|
|
@@ -8,9 +8,10 @@ const configs = [
|
|
|
8
8
|
jsxA11y.flatConfigs.recommended,
|
|
9
9
|
];
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
/** @type {(options?: {version?: string}) => import('xo').FlatXoConfig} */
|
|
12
|
+
export default ({ version = "detect" } = {}) => [{ react: true, settings: { react: { version } } }, ...configs, {
|
|
12
13
|
plugins: {
|
|
13
|
-
"react-refresh": reactRefresh,
|
|
14
|
+
"react-refresh": reactRefresh.plugin,
|
|
14
15
|
"sort-react-dependency-arrays": sortReactDependencyArrays,
|
|
15
16
|
},
|
|
16
17
|
rules: {
|
|
@@ -42,6 +43,9 @@ export default [{ react: true }, ...configs, {
|
|
|
42
43
|
pascalCase: true,
|
|
43
44
|
},
|
|
44
45
|
}],
|
|
46
|
+
...version === "19" && {
|
|
47
|
+
"react/forward-ref-uses-ref": "off",
|
|
48
|
+
},
|
|
45
49
|
},
|
|
46
50
|
}, {
|
|
47
51
|
files: ["src/constants/**/*.{ts,cts,mts,tsx}", "**/constants.{ts,cts,mts,tsx}"],
|
|
@@ -52,11 +56,11 @@ export default [{ react: true }, ...configs, {
|
|
|
52
56
|
files: "**/*.{ts,cts,mts,tsx}",
|
|
53
57
|
rules: {
|
|
54
58
|
"perfectionist/sort-interfaces": ["error", {
|
|
55
|
-
customGroups: {
|
|
59
|
+
customGroups: [{ elementNamePattern: "^on[A-Z].*", groupName: "callback" }],
|
|
56
60
|
groups: ["unknown", "callback"],
|
|
57
61
|
}],
|
|
58
62
|
"perfectionist/sort-object-types": ["error", {
|
|
59
|
-
customGroups: {
|
|
63
|
+
customGroups: [{ elementNamePattern: "^on[A-Z].*", groupName: "callback" }],
|
|
60
64
|
groups: ["unknown", "callback"],
|
|
61
65
|
}],
|
|
62
66
|
},
|
package/src/tailwind.js
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import tailwind from "eslint-plugin-tailwindcss";
|
|
1
|
+
import eslintPluginBetterTailwindcss from "eslint-plugin-better-tailwindcss";
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
/** @type {({config}: {config: string}) => import('xo').FlatXoConfig} */
|
|
4
|
+
export default ({ config }) => [{
|
|
5
5
|
plugins: {
|
|
6
|
-
"
|
|
6
|
+
"better-tailwindcss": eslintPluginBetterTailwindcss,
|
|
7
7
|
},
|
|
8
8
|
rules: {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
...eslintPluginBetterTailwindcss.configs.recommended.rules,
|
|
10
|
+
"better-tailwindcss/enforce-consistent-line-wrapping": ["warn", {
|
|
11
11
|
indent: "tab",
|
|
12
12
|
preferSingleLine: true,
|
|
13
13
|
printWidth: 120,
|
|
14
14
|
}],
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}],
|
|
15
|
+
},
|
|
16
|
+
settings: {
|
|
17
|
+
"better-tailwindcss": {
|
|
18
|
+
callees: ["clsx", "cn", "cnx", "cva", "cx", "tv", "twJoin", "twMerge"],
|
|
19
|
+
entryPoint: config, // v4 config path
|
|
20
|
+
},
|
|
22
21
|
},
|
|
23
22
|
}];
|
package/src/xo.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import perfectionist from "eslint-plugin-perfectionist";
|
|
2
2
|
import simpleImportSort from "eslint-plugin-simple-import-sort";
|
|
3
3
|
|
|
4
|
+
/** @type {import('xo').FlatXoConfig} */
|
|
4
5
|
export default [{
|
|
5
6
|
plugins: {
|
|
6
7
|
perfectionist,
|
|
@@ -41,7 +42,7 @@ export default [{
|
|
|
41
42
|
"@typescript-eslint/no-confusing-void-expression": ["error", { ignoreArrowShorthand: true }],
|
|
42
43
|
// https://github.com/xojs/eslint-config-xo-typescript/blob/v2.0.0/index.js#L707
|
|
43
44
|
"@typescript-eslint/prefer-regexp-exec": "off",
|
|
44
|
-
"perfectionist/sort-enums":
|
|
45
|
+
"perfectionist/sort-enums": "error",
|
|
45
46
|
"perfectionist/sort-heritage-clauses": "error",
|
|
46
47
|
"perfectionist/sort-interfaces": "error",
|
|
47
48
|
"perfectionist/sort-intersection-types": "error",
|