@tommy-mitchell/eslint-config-xo 0.4.0 → 0.6.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 CHANGED
@@ -1,33 +1,48 @@
1
1
  "use strict";
2
2
 
3
3
  module.exports = {
4
- plugins: ["simple-import-sort"],
4
+ plugins: ["perfectionist", "simple-import-sort"],
5
+ settings: {
6
+ perfectionist: {
7
+ partitionByComment: "(group) *",
8
+ type: "natural",
9
+ },
10
+ },
5
11
  rules: {
6
12
  // https://github.com/xojs/eslint-config-xo/blob/v0.44.0/index.js#L304
7
13
  "capitalized-comments": "off",
14
+ "import/extensions": "off",
15
+ "import/order": "off",
8
16
  // https://github.com/xojs/eslint-config-xo/blob/v0.44.0/index.js#L186
9
17
  "no-warning-comments": ["warn", { decoration: ["/", "*"] }],
10
18
  "object-shorthand": "off",
11
- "import/extensions": "off",
12
- "import/order": "off",
13
- // "n/file-extension-in-import": ["error", "always"],
19
+ "perfectionist/sort-array-includes": "error",
20
+ "perfectionist/sort-maps": "error",
21
+ "perfectionist/sort-objects": "error",
22
+ // TODO: doesn't play nice with unicorn/switch-case-braces: https://github.com/azat-io/eslint-plugin-perfectionist/issues/54#issuecomment-2268283085
23
+ "perfectionist/sort-switch-case": "error",
24
+ "simple-import-sort/exports": "error",
14
25
  "simple-import-sort/imports": ["error", {
15
26
  groups: [["^\\u0000", "^node:", "^react", "^react-dom", "^@?\\w", "^", "^\\."]],
16
27
  }],
17
- "simple-import-sort/exports": "error",
18
28
  "unicorn/prefer-regexp-test": "off",
19
29
  "unicorn/prevent-abbreviations": "off",
20
30
  },
21
31
  overrides: [{
22
32
  files: "**/*.{ts,cts,mts,tsx}",
23
33
  settings: {
24
- n: { typescriptExtensionMap: [[".ts", ".ts"]] },
34
+ n: { typescriptExtensionMap: [[".ts", ".ts"], [".tsx", ".tsx"]] },
25
35
  },
26
36
  rules: {
27
37
  // https://github.com/xojs/eslint-config-xo-typescript/blob/v2.0.0/index.js#L384
28
38
  "@typescript-eslint/no-confusing-void-expression": ["error", { ignoreArrowShorthand: true }],
29
39
  // https://github.com/xojs/eslint-config-xo-typescript/blob/v2.0.0/index.js#L707
30
40
  "@typescript-eslint/prefer-regexp-exec": "off",
41
+ "perfectionist/sort-enums": ["error", { forceNumericSort: true }],
42
+ "perfectionist/sort-interfaces": "error",
43
+ "perfectionist/sort-intersection-types": "error",
44
+ "perfectionist/sort-object-types": "error",
45
+ "perfectionist/sort-union-types": "error",
31
46
  },
32
47
  }],
33
48
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tommy-mitchell/eslint-config-xo",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Personal config for XO.",
5
5
  "keywords": [
6
6
  "nodejs",
@@ -29,11 +29,13 @@
29
29
  "eslint-config-xo-react": "^0.27.0",
30
30
  "eslint-plugin-dprint-integration": "^0.3.0",
31
31
  "eslint-plugin-jsx-a11y": "^6.9.0",
32
+ "eslint-plugin-perfectionist": "^3.2.0",
32
33
  "eslint-plugin-react": "^7.35.0",
33
34
  "eslint-plugin-react-hooks": "^4.6.2",
34
35
  "eslint-plugin-react-refresh": "^0.4.9",
35
- "eslint-plugin-readable-tailwind": "^1.5.3",
36
+ "eslint-plugin-readable-tailwind": "^1.7.0",
36
37
  "eslint-plugin-simple-import-sort": "^12.1.1",
38
+ "eslint-plugin-sort-react-dependency-arrays": "^1.0.0",
37
39
  "eslint-plugin-tailwindcss": "^3.17.4"
38
40
  },
39
41
  "devDependencies": {
package/react.js CHANGED
@@ -6,12 +6,11 @@ module.exports = {
6
6
  "plugin:react/jsx-runtime",
7
7
  "plugin:jsx-a11y/recommended",
8
8
  ],
9
- plugins: ["react-refresh"],
9
+ plugins: ["react-refresh", "sort-react-dependency-arrays"],
10
10
  rules: {
11
11
  "react/no-array-index-key": "warn",
12
- "react-refresh/only-export-components": ["warn", {
13
- allowConstantExport: true,
14
- }],
12
+ "react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
13
+ "sort-react-dependency-arrays/sort": "error",
15
14
  "unicorn/filename-case": ["error", {
16
15
  cases: {
17
16
  camelCase: true,
@@ -25,5 +24,17 @@ module.exports = {
25
24
  rules: {
26
25
  "@typescript-eslint/naming-convention": "off",
27
26
  },
27
+ }, {
28
+ files: "**/*.{ts,cts,mts,tsx}",
29
+ rules: {
30
+ "perfectionist/sort-interfaces": ["error", {
31
+ customGroups: { callback: "on*" },
32
+ groups: ["unknown", "callback"],
33
+ }],
34
+ "perfectionist/sort-object-types": ["error", {
35
+ customGroups: { callback: "on*" },
36
+ groups: ["unknown", "callback"],
37
+ }],
38
+ },
28
39
  }],
29
40
  };
package/tailwind.js CHANGED
@@ -7,8 +7,10 @@ module.exports = {
7
7
  "readable-tailwind/multiline": ["warn", {
8
8
  group: "newLine",
9
9
  indent: "tab",
10
+ preferSingleLine: true,
10
11
  printWidth: 120,
11
12
  }],
13
+ "readable-tailwind/no-duplicate-classes": "warn",
12
14
  "readable-tailwind/no-unnecessary-whitespace": "warn",
13
15
  "readable-tailwind/sort-classes": "warn",
14
16
  "tailwindcss/classnames-order": "off",