@tommy-mitchell/eslint-config-xo 1.0.0-2 → 1.0.0-4

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-2",
3
+ "version": "1.0.0-4",
4
4
  "description": "Personal config for XO.",
5
5
  "keywords": [
6
6
  "nodejs",
package/src/dprint.js CHANGED
@@ -1,7 +1,27 @@
1
1
  import stylistic from "@stylistic/eslint-plugin";
2
2
 
3
- // TODO: eslint unicorn rule proposal
4
- const allowedRules = new Set(["padding-line-between-statements"]);
3
+ const allowedReactRules = new Set([
4
+ "jsx-curly-brace-presence",
5
+ "jsx-newline",
6
+ "jsx-pascal-case",
7
+ "jsx-self-closing-comp",
8
+ "jsx-sort-props",
9
+ ]);
10
+
11
+ const disabledLegacyRules = Object.fromEntries(
12
+ Object.entries(stylistic.configs["disable-legacy"].rules)
13
+ .filter(([rule]) => !allowedReactRules.has(rule.replace("react/", ""))),
14
+ );
15
+
16
+ const allowedRules = new Set([
17
+ // "multiline-ternary",
18
+ "no-floating-decimal",
19
+ "no-mixed-operators",
20
+ "padding-line-between-statements",
21
+ "wrap-iife",
22
+ ...allowedReactRules,
23
+ ]);
24
+
5
25
  const disabledRules = Object.fromEntries(
6
26
  Object.keys(stylistic.rules)
7
27
  .filter(rule => !allowedRules.has(rule))
@@ -17,6 +37,6 @@ export default [
17
37
  "no-comma-dangle": "off",
18
38
  },
19
39
  },
20
- stylistic.configs["disable-legacy"],
40
+ { rules: disabledLegacyRules },
21
41
  { rules: disabledRules },
22
42
  ];
package/src/react.js CHANGED
@@ -8,13 +8,19 @@ const configs = [
8
8
  jsxA11y.flatConfigs.recommended,
9
9
  ];
10
10
 
11
- export default [...configs, {
11
+ export default [{ react: true }, ...configs, {
12
12
  plugins: {
13
13
  "react-refresh": reactRefresh,
14
14
  "sort-react-dependency-arrays": sortReactDependencyArrays,
15
15
  },
16
16
  rules: {
17
17
  "react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
18
+ "react/jsx-sort-props": ["error", {
19
+ callbacksLast: true,
20
+ noSortAlphabetically: false,
21
+ reservedFirst: true,
22
+ shorthandFirst: true,
23
+ }],
18
24
  "react/no-array-index-key": "warn",
19
25
  "simple-import-sort/imports": ["error", {
20
26
  groups: [[
@@ -37,6 +43,11 @@ export default [...configs, {
37
43
  },
38
44
  }],
39
45
  },
46
+ }, {
47
+ files: ["src/constants/**/*.{ts,cts,mts,tsx}", "**/constants.{ts,cts,mts,tsx}"],
48
+ rules: {
49
+ "@typescript-eslint/naming-convention": "off",
50
+ },
40
51
  }, {
41
52
  files: "**/*.{ts,cts,mts,tsx}",
42
53
  rules: {