@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tommy-mitchell/eslint-config-xo",
3
- "version": "1.0.0-5",
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/eslintrc": "^3.3.0",
32
- "@next/eslint-plugin-next": "^15.2.2",
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": "^4.10.1",
35
- "eslint-plugin-react-refresh": "^0.4.19",
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": "^3.0.1",
43
- "@tommy-mitchell/dprint-config": "^0.5.0",
44
- "ava": "^6.2.0",
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.4",
47
- "execa": "^9.5.2",
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": "npm:@spence-s/flat-xo@0.0.10"
49
+ "xo": "~2.0.2"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "dprint": "0.x",
53
53
  "react": "19.x",
54
- "tailwindcss": "3.x",
55
- "xo": "0.x"
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": "^18.20 || ^20.10 || >=21"
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@beta xo@npm:@spence-s/flat-xo@latest
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@beta xo@npm:@spence-s/flat-xo@latest
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@beta xo@npm:@spence-s/flat-xo@latest @tommy-mitchell/dprint-config dprint
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
- yarn add --dev @tommy-mitchell/eslint-config-xo@beta xo@npm:@spence-s/flat-xo@latest @tommy-mitchell/dprint-config dprint
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 Tailwind CSS
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
@@ -28,6 +28,7 @@ const disabledRules = Object.fromEntries(
28
28
  .map(rule => [`@stylistic/${rule}`, "off"]),
29
29
  );
30
30
 
31
+ /** @type {import('xo').FlatXoConfig} */
31
32
  export default [
32
33
  {
33
34
  rules: {
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
- const compat = new FlatCompat({
5
- baseDirectory: import.meta.dirname,
6
- });
7
-
4
+ /** @type {import('xo').FlatXoConfig} */
8
5
  export default [
9
- ...compat.config(next.configs["core-web-vitals"]),
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
- export default [{ react: true }, ...configs, {
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: { callback: "^on[A-Z].*" },
59
+ customGroups: [{ elementNamePattern: "^on[A-Z].*", groupName: "callback" }],
56
60
  groups: ["unknown", "callback"],
57
61
  }],
58
62
  "perfectionist/sort-object-types": ["error", {
59
- customGroups: { callback: "^on[A-Z].*" },
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 eslintPluginReadableTailwind from "eslint-plugin-readable-tailwind";
2
- import tailwind from "eslint-plugin-tailwindcss";
1
+ import eslintPluginBetterTailwindcss from "eslint-plugin-better-tailwindcss";
3
2
 
4
- export default [...tailwind.configs["flat/recommended"], {
3
+ /** @type {({config}: {config: string}) => import('xo').FlatXoConfig} */
4
+ export default ({ config }) => [{
5
5
  plugins: {
6
- "readable-tailwind": eslintPluginReadableTailwind,
6
+ "better-tailwindcss": eslintPluginBetterTailwindcss,
7
7
  },
8
8
  rules: {
9
- "readable-tailwind/multiline": ["warn", {
10
- group: "newLine",
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
- "readable-tailwind/no-duplicate-classes": "warn",
16
- "readable-tailwind/no-unnecessary-whitespace": "warn",
17
- "readable-tailwind/sort-classes": "warn",
18
- "tailwindcss/classnames-order": "off",
19
- "tailwindcss/no-custom-classname": ["warn", {
20
- callees: ["classnames", "clsx", "ctl", "cva", "tv", "tva", "tw", "twMerge", "cn", "cnx"],
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": ["error", { forceNumericSort: true }],
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",