@tommy-mitchell/eslint-config-xo 1.0.0 → 2.0.0-beta.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tommy-mitchell/eslint-config-xo",
3
- "version": "1.0.0",
3
+ "version": "2.0.0-beta.1",
4
4
  "description": "Personal config for XO.",
5
5
  "keywords": [
6
6
  "nodejs",
@@ -28,31 +28,32 @@
28
28
  "test": "ava"
29
29
  },
30
30
  "dependencies": {
31
+ "@eslint-react/eslint-plugin": "^3.0.0",
31
32
  "@next/eslint-plugin-next": "^16.0.5",
32
- "eslint-plugin-better-tailwindcss": "^3.7.11",
33
+ "eslint-plugin-better-tailwindcss": "^4.3.2",
33
34
  "eslint-plugin-jsx-a11y": "^6.10.2",
34
- "eslint-plugin-perfectionist": "^4.15.1",
35
- "eslint-plugin-react-refresh": "^0.4.24",
35
+ "eslint-plugin-perfectionist": "^5.7.0",
36
+ "eslint-plugin-react-refresh": "^0.5.2",
36
37
  "eslint-plugin-simple-import-sort": "^12.1.1",
37
38
  "eslint-plugin-sort-react-dependency-arrays": "^1.0.0"
38
39
  },
39
40
  "devDependencies": {
40
41
  "@stylistic/eslint-plugin": "^5.6.1",
41
42
  "@tommy-mitchell/dprint-config": "0.6.0",
42
- "ava": "^6.4.1",
43
+ "ava": "^7.0.0",
43
44
  "dprint": "0.x",
44
- "eslint-plugin-react": "^7.37.5",
45
45
  "execa": "^9.6.0",
46
46
  "react": "^19.2.0",
47
47
  "tailwindcss": "^4.1.17",
48
48
  "tempy": "^3.1.0",
49
- "xo": "~1.2.3"
49
+ "typescript": "6.0.2",
50
+ "xo": "~2.0.2"
50
51
  },
51
52
  "peerDependencies": {
52
53
  "dprint": "0.x",
53
54
  "react": "19.x",
54
55
  "tailwindcss": "4.x",
55
- "xo": "1.x"
56
+ "xo": "2.x"
56
57
  },
57
58
  "peerDependenciesMeta": {
58
59
  "dprint": {
@@ -66,7 +67,7 @@
66
67
  }
67
68
  },
68
69
  "engines": {
69
- "node": ">=20.17"
70
+ "node": ">=22"
70
71
  },
71
72
  "ava": {
72
73
  "timeout": "30s"
package/readme.md CHANGED
@@ -16,6 +16,10 @@ npm install --save-dev @tommy-mitchell/eslint-config-xo xo
16
16
  yarn add --dev @tommy-mitchell/eslint-config-xo xo
17
17
  ```
18
18
 
19
+ ```sh
20
+ pnpm add --save-dev @tommy-mitchell/eslint-config-xo xo
21
+ ```
22
+
19
23
  </p>
20
24
  </details>
21
25
 
@@ -31,6 +35,10 @@ npm install --save-dev @tommy-mitchell/eslint-config-xo xo @tommy-mitchell/dprin
31
35
  yarn add --dev @tommy-mitchell/eslint-config-xo xo @tommy-mitchell/dprint-config dprint
32
36
  ```
33
37
 
38
+ ```sh
39
+ pnpm add --save-dev @tommy-mitchell/eslint-config-xo xo @tommy-mitchell/dprint-config dprint
40
+ ```
41
+
34
42
  </p>
35
43
  </details>
36
44
 
@@ -50,9 +58,9 @@ import * as configs from "@tommy-mitchell/eslint-config-xo";
50
58
  /** @type {import('xo').FlatXoConfig} */
51
59
  export default [
52
60
  ...configs.xo,
53
- ...configs.react, // If using React
61
+ ...configs.react({ version: "19" }), // If using React
54
62
  ...configs.next, // If using Next.js
55
- ...configs.tailwind, // If using Tailwind CSS
63
+ ...configs.tailwind({ config: "src/tailwind.css" }), // If using TailwindCSS
56
64
  ...configs.dprint, // If using dprint (must be last to override stylistic rules)
57
65
  // Plus any overrides
58
66
  ]
package/src/dprint.js CHANGED
@@ -5,12 +5,11 @@ const allowedReactRules = new Set([
5
5
  "jsx-newline",
6
6
  "jsx-pascal-case",
7
7
  "jsx-self-closing-comp",
8
- "jsx-sort-props",
9
8
  ]);
10
9
 
11
10
  const disabledLegacyRules = Object.fromEntries(
12
11
  Object.entries(stylistic.configs["disable-legacy"].rules)
13
- .filter(([rule]) => !allowedReactRules.has(rule.replace("react/", ""))),
12
+ .filter(([rule]) => !allowedReactRules.has(rule.replace("@stylistic/", ""))),
14
13
  );
15
14
 
16
15
  const allowedRules = new Set([
package/src/index.d.ts CHANGED
@@ -3,5 +3,5 @@ import type { FlatXoConfig } from "xo";
3
3
  export declare const dprint: FlatXoConfig;
4
4
  export declare const next: FlatXoConfig;
5
5
  export declare const react: FlatXoConfig;
6
- export declare const tailwind: FlatXoConfig;
6
+ export declare const tailwind: ({ config }: { config: string; }) => FlatXoConfig;
7
7
  export declare const xo: FlatXoConfig;
package/src/next.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import next from "@next/eslint-plugin-next";
2
- import reactRefresh from "eslint-plugin-react-refresh";
2
+ import { reactRefresh } from "eslint-plugin-react-refresh";
3
3
 
4
4
  /** @type {import('xo').FlatXoConfig} */
5
5
  export default [
package/src/react.js CHANGED
@@ -1,28 +1,29 @@
1
+ import eslintReact from "@eslint-react/eslint-plugin";
1
2
  import jsxA11y from "eslint-plugin-jsx-a11y";
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 = [
7
- react.configs.flat["jsx-runtime"],
7
+ eslintReact.configs["strict-type-checked"],
8
8
  jsxA11y.flatConfigs.recommended,
9
9
  ];
10
10
 
11
11
  /** @type {import('xo').FlatXoConfig} */
12
- export default [{ react: true }, ...configs, {
12
+ export default [...configs, {
13
13
  plugins: {
14
- "react-refresh": reactRefresh,
14
+ "react-refresh": reactRefresh.plugin,
15
15
  "sort-react-dependency-arrays": sortReactDependencyArrays,
16
16
  },
17
+ // TODO: boolean-prop-naming
17
18
  rules: {
18
- "react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
19
- "react/jsx-sort-props": ["error", {
20
- callbacksLast: true,
21
- noSortAlphabetically: false,
22
- reservedFirst: true,
23
- shorthandFirst: true,
19
+ "perfectionist/sort-jsx-props": ["error", {
20
+ customGroups: [
21
+ { elementNamePattern: "^on[A-Z].*", groupName: "callback" },
22
+ { elementNamePattern: "^(children|dangerouslySetInnerHTML|key|ref)$", groupName: "reserved" },
23
+ ],
24
+ groups: ["reserved", "shorthand-prop", "unknown", "callback"],
24
25
  }],
25
- "react/no-array-index-key": "warn",
26
+ "react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
26
27
  "simple-import-sort/imports": ["error", {
27
28
  groups: [[
28
29
  String.raw`^\u0000`,
@@ -53,11 +54,11 @@ export default [{ react: true }, ...configs, {
53
54
  files: "**/*.{ts,cts,mts,tsx}",
54
55
  rules: {
55
56
  "perfectionist/sort-interfaces": ["error", {
56
- customGroups: { callback: "^on[A-Z].*" },
57
+ customGroups: [{ elementNamePattern: "^on[A-Z].*", groupName: "callback" }],
57
58
  groups: ["unknown", "callback"],
58
59
  }],
59
60
  "perfectionist/sort-object-types": ["error", {
60
- customGroups: { callback: "^on[A-Z].*" },
61
+ customGroups: [{ elementNamePattern: "^on[A-Z].*", groupName: "callback" }],
61
62
  groups: ["unknown", "callback"],
62
63
  }],
63
64
  },
package/src/tailwind.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import eslintPluginBetterTailwindcss from "eslint-plugin-better-tailwindcss";
2
2
 
3
- /** @type {import('xo').FlatXoConfig} */
4
- export default [{
3
+ /** @type {({config}: {config: string}) => import('xo').FlatXoConfig} */
4
+ export default ({ config }) => [{
5
5
  plugins: {
6
6
  "better-tailwindcss": eslintPluginBetterTailwindcss,
7
7
  },
@@ -12,12 +12,11 @@ export default [{
12
12
  preferSingleLine: true,
13
13
  printWidth: 120,
14
14
  }],
15
- "better-tailwindcss/enforce-shorthand-classes": "warn",
16
- "better-tailwindcss/no-deprecated-classes": "warn",
17
15
  },
18
16
  settings: {
19
17
  "better-tailwindcss": {
20
18
  callees: ["clsx", "cn", "cnx", "cva", "cx", "tv", "twJoin", "twMerge"],
19
+ entryPoint: config, // v4 config path
21
20
  },
22
21
  },
23
22
  }];
package/src/xo.js CHANGED
@@ -42,7 +42,7 @@ export default [{
42
42
  "@typescript-eslint/no-confusing-void-expression": ["error", { ignoreArrowShorthand: true }],
43
43
  // https://github.com/xojs/eslint-config-xo-typescript/blob/v2.0.0/index.js#L707
44
44
  "@typescript-eslint/prefer-regexp-exec": "off",
45
- "perfectionist/sort-enums": ["error", { forceNumericSort: true }],
45
+ "perfectionist/sort-enums": "error",
46
46
  "perfectionist/sort-heritage-clauses": "error",
47
47
  "perfectionist/sort-interfaces": "error",
48
48
  "perfectionist/sort-intersection-types": "error",