@ethang/eslint-config 19.0.10 → 19.0.11

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.
@@ -14,6 +14,7 @@ import { perfectionistRules } from "../setup/perfectionist.js";
14
14
  import { a11yRules } from "../setup/a11y.js";
15
15
  import { readFileSync, writeFileSync } from "node:fs";
16
16
  import { join } from "node:path";
17
+ import { deprecatedRules } from "../setup/deprecated.js";
17
18
 
18
19
  export const updateRules = () => {
19
20
  const rules = {
@@ -31,6 +32,7 @@ export const updateRules = () => {
31
32
  ...stylisticRules,
32
33
  ...perfectionistRules,
33
34
  ...a11yRules,
35
+ ...deprecatedRules,
34
36
  };
35
37
 
36
38
  let jsonified = JSON.stringify(rules);
package/config.astro.js CHANGED
@@ -1,7 +1,9 @@
1
1
  import astro from "eslint-plugin-astro";
2
2
  import tseslint from "typescript-eslint";
3
3
 
4
- import { ignores, languageOptions } from "./eslint.config.js";
4
+ import { languageOptions } from "./eslint.config.js";
5
+ import { ignores } from "./constants.js";
6
+ import { astroRules } from "./setup/astro.js";
5
7
 
6
8
  export default tseslint.config({
7
9
  files: ["**/*.{astro}"],
@@ -9,56 +11,6 @@ export default tseslint.config({
9
11
  languageOptions,
10
12
  plugins: { astro },
11
13
  rules: {
12
- "astro/jsx-a11y/alt-text": "error",
13
- "astro/jsx-a11y/anchor-ambiguous-text": "error",
14
- "astro/jsx-a11y/anchor-has-content": "error",
15
- "astro/jsx-a11y/anchor-is-valid": "error",
16
- "astro/jsx-a11y/aria-activedescendant-has-tabindex": "error",
17
- "astro/jsx-a11y/aria-props": "error",
18
- "astro/jsx-a11y/aria-proptypes": "error",
19
- "astro/jsx-a11y/aria-role": "error",
20
- "astro/jsx-a11y/aria-unsupported-elements": "error",
21
- "astro/jsx-a11y/autocomplete-valid": "error",
22
- "astro/jsx-a11y/click-events-have-key-events": "error",
23
- "astro/jsx-a11y/control-has-associated-label": "error",
24
- "astro/jsx-a11y/heading-has-content": "error",
25
- "astro/jsx-a11y/html-has-lang": "error",
26
- "astro/jsx-a11y/iframe-has-title": "error",
27
- "astro/jsx-a11y/img-redundant-alt": "error",
28
- "astro/jsx-a11y/interactive-supports-focus": "error",
29
- "astro/jsx-a11y/label-has-associated-control": "error",
30
- "astro/jsx-a11y/lang": "error",
31
- "astro/jsx-a11y/media-has-caption": "error",
32
- "astro/jsx-a11y/mouse-events-have-key-events": "error",
33
- "astro/jsx-a11y/no-access-key": "error",
34
- "astro/jsx-a11y/no-aria-hidden-on-focusable": "error",
35
- "astro/jsx-a11y/no-autofocus": "error",
36
- "astro/jsx-a11y/no-distracting-elements": "error",
37
- "astro/jsx-a11y/no-interactive-element-to-noninteractive-role": "error",
38
- "astro/jsx-a11y/no-noninteractive-element-interactions": "error",
39
- "astro/jsx-a11y/no-noninteractive-element-to-interactive-role": "error",
40
- "astro/jsx-a11y/no-noninteractive-tabindex": "error",
41
- "astro/jsx-a11y/no-redundant-roles": "error",
42
- "astro/jsx-a11y/no-static-element-interactions": "error",
43
- "astro/jsx-a11y/prefer-tag-over-role": "error",
44
- "astro/jsx-a11y/role-has-required-aria-props": "error",
45
- "astro/jsx-a11y/role-supports-aria-props": "error",
46
- "astro/jsx-a11y/scope": "error",
47
- "astro/jsx-a11y/tabindex-no-positive": "error",
48
- "astro/missing-client-only-directive-value": "error",
49
- "astro/no-conflict-set-directives": "error",
50
- "astro/no-deprecated-astro-canonicalurl": "error",
51
- "astro/no-deprecated-astro-fetchcontent": "error",
52
- "astro/no-deprecated-astro-resolve": "error",
53
- "astro/no-deprecated-getentrybyslug": "error",
54
- "astro/no-exports-from-components": "error",
55
- "astro/no-set-text-directive": "error",
56
- "astro/no-unused-css-selector": "error",
57
- "astro/no-unused-define-vars-in-style": "error",
58
- "astro/prefer-class-list-directive": "error",
59
- "astro/prefer-object-class-list": "error",
60
- "astro/prefer-split-class-list": "error",
61
- "astro/semi": "error",
62
- "astro/valid-compile": "error",
14
+ ...astroRules,
63
15
  },
64
16
  });
package/config.react.js CHANGED
@@ -2,7 +2,9 @@ import react from "@eslint-react/eslint-plugin";
2
2
  import reactHooks from "eslint-plugin-react-hooks";
3
3
  import tseslint from "typescript-eslint";
4
4
 
5
- import { ignores, languageOptions } from "./eslint.config.js";
5
+ import { languageOptions } from "./eslint.config.js";
6
+ import { ignores } from "./constants.js";
7
+ import { reactRules } from "./setup/react.js";
6
8
 
7
9
  export default tseslint.config({
8
10
  files: ["**/*.{jsx,tsx}"],
@@ -10,79 +12,9 @@ export default tseslint.config({
10
12
  languageOptions,
11
13
  plugins: {
12
14
  react,
13
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
14
15
  "react-hooks": reactHooks,
15
16
  },
16
17
  rules: {
17
- "react-hooks/exhaustive-deps": "off", // TODO fix w/ v9 compatibility
18
- "react-hooks/rules-of-hooks": "off", // TODO fix w/ v9 compatibility
19
- "react/dom/no-children-in-void-dom-elements": "error",
20
- "react/dom/no-dangerously-set-innerhtml": "error",
21
- "react/dom/no-dangerously-set-innerhtml-with-children": "error",
22
- "react/dom/no-find-dom-node": "error",
23
- "react/dom/no-missing-button-type": "error",
24
- "react/dom/no-missing-iframe-sandbox": "error",
25
- "react/dom/no-namespace": "error",
26
- "react/dom/no-render-return-value": "error",
27
- "react/dom/no-script-url": "error",
28
- "react/dom/no-unsafe-iframe-sandbox": "error",
29
- "react/dom/no-unsafe-target-blank": "error",
30
- "react/ensure-forward-ref-using-ref": "error",
31
- "react/hooks-extra/ensure-custom-hooks-using-other-hooks": "error",
32
- "react/hooks-extra/ensure-use-callback-has-non-empty-deps": "error",
33
- "react/hooks-extra/ensure-use-memo-has-non-empty-deps": "error",
34
- "react/hooks-extra/no-direct-set-state-in-use-effect": "error",
35
- "react/hooks-extra/no-direct-set-state-in-use-layout-effect": "error",
36
- "react/hooks-extra/prefer-use-state-lazy-initialization": "error",
37
- "react/naming-convention/component-name": "error",
38
- "react/naming-convention/filename": ["error", { rule: "kebab-case" }],
39
- "react/naming-convention/filename-extension": "error",
40
- "react/naming-convention/use-state": "error",
41
- "react/no-access-state-in-setstate": "error",
42
- "react/no-array-index-key": "error",
43
- "react/no-children-count": "error",
44
- "react/no-children-for-each": "error",
45
- "react/no-children-map": "error",
46
- "react/no-children-only": "error",
47
- "react/no-children-prop": "error",
48
- "react/no-children-to-array": "error",
49
- "react/no-class-component": "error",
50
- "react/no-clone-element": "error",
51
- "react/no-comment-textnodes": "error",
52
- "react/no-complex-conditional-rendering": "error",
53
- "react/no-complicated-conditional-rendering": "error",
54
- "react/no-component-will-mount": "error",
55
- "react/no-component-will-receive-props": "error",
56
- "react/no-component-will-update": "error",
57
- "react/no-create-ref": "error",
58
- "react/no-default-props": "error",
59
- "react/no-direct-mutation-state": "error",
60
- "react/no-duplicate-key": "error",
61
- "react/no-implicit-key": "error",
62
- "react/no-leaked-conditional-rendering": "error",
63
- "react/no-missing-component-display-name": "error",
64
- "react/no-missing-key": "error",
65
- "react/no-nested-components": "error",
66
- "react/no-prop-types": "error",
67
- "react/no-redundant-should-component-update": "error",
68
- "react/no-set-state-in-component-did-mount": "error",
69
- "react/no-set-state-in-component-did-update": "error",
70
- "react/no-set-state-in-component-will-update": "error",
71
- "react/no-string-refs": "error",
72
- "react/no-unsafe-component-will-mount": "error",
73
- "react/no-unsafe-component-will-receive-props": "error",
74
- "react/no-unsafe-component-will-update": "error",
75
- "react/no-unstable-context-value": "error",
76
- "react/no-unstable-default-props": "error",
77
- "react/no-unused-class-component-members": "error",
78
- "react/no-unused-state": "error",
79
- "react/no-useless-fragment": "error",
80
- "react/prefer-destructuring-assignment": "error",
81
- "react/prefer-read-only-props": "error",
82
- "react/prefer-shorthand-boolean": "error",
83
- "react/prefer-shorthand-fragment": "error",
84
- "react/web-api/no-leaked-event-listener": "error",
85
- "react/web-api/no-leaked-interval": "error",
86
- "react/web-api/no-leaked-timeout": "error",
18
+ ...reactRules,
87
19
  },
88
20
  });
package/config.solid.js CHANGED
@@ -1,7 +1,9 @@
1
1
  import solid from "eslint-plugin-solid";
2
2
  import tseslint from "typescript-eslint";
3
3
 
4
- import { ignores, languageOptions } from "./eslint.config.js";
4
+ import { languageOptions } from "./eslint.config.js";
5
+ import { ignores } from "./constants.js";
6
+ import { solidRules } from "./setup/solid.js";
5
7
 
6
8
  export default tseslint.config({
7
9
  files: ["**/*.{jsx,tsx}"],
@@ -9,23 +11,6 @@ export default tseslint.config({
9
11
  languageOptions,
10
12
  plugins: { solid },
11
13
  rules: {
12
- "solid/components-return-once": "error",
13
- "solid/event-handlers": "error",
14
- "solid/imports": "error",
15
- "solid/jsx-no-duplicate-props": "error",
16
- "solid/jsx-no-script-url": "error",
17
- "solid/jsx-no-undef": "error",
18
- "solid/jsx-uses-vars": "error",
19
- "solid/no-array-handlers": "error",
20
- "solid/no-destructure": "error",
21
- "solid/no-innerhtml": "error",
22
- "solid/no-react-deps": "error",
23
- "solid/no-react-specific-props": "error",
24
- "solid/no-unknown-namespaces": "error",
25
- "solid/prefer-for": "error",
26
- "solid/prefer-show": "error",
27
- "solid/reactivity": "error",
28
- "solid/self-closing-comp": "error",
29
- "solid/style-prop": "error",
14
+ ...solidRules,
30
15
  },
31
16
  });
package/constants.js ADDED
@@ -0,0 +1 @@
1
+ export const ignores = ["eslint.config.js", "node_modules", "dist"];
package/eslint.config.js CHANGED
@@ -13,6 +13,7 @@ import compat from "eslint-plugin-compat";
13
13
  import lodashConfig from "eslint-plugin-lodash";
14
14
  import tailwind from "eslint-plugin-tailwindcss";
15
15
  import stylistic from "@stylistic/eslint-plugin";
16
+ import { ignores } from "./constants.js";
16
17
 
17
18
  export const languageOptions = {
18
19
  parser,
@@ -22,8 +23,6 @@ export const languageOptions = {
22
23
  },
23
24
  };
24
25
 
25
- export const ignores = ["eslint.config.js", "node_modules", "dist"];
26
-
27
26
  export default tseslint.config({
28
27
  files: ["**/*.{js,ts,jsx,tsx,cjs,cts,mjs,mts}"],
29
28
  ignores,
@@ -1584,5 +1583,98 @@ export default tseslint.config({
1584
1583
  "a11y/role-supports-aria-props": "error",
1585
1584
  "a11y/scope": "error",
1586
1585
  "a11y/tabindex-no-positive": "error",
1586
+ "array-bracket-newline": "off",
1587
+ "array-bracket-spacing": "off",
1588
+ "array-element-newline": "off",
1589
+ "arrow-parens": "off",
1590
+ "arrow-spacing": "off",
1591
+ "block-spacing": "off",
1592
+ "brace-style": "off",
1593
+ "callback-return": "off",
1594
+ "comma-dangle": "off",
1595
+ "comma-spacing": "off",
1596
+ "comma-style": "off",
1597
+ "computed-property-spacing": "off",
1598
+ "dot-location": "off",
1599
+ "eol-last": "off",
1600
+ "func-call-spacing": "off",
1601
+ "function-call-argument-newline": "off",
1602
+ "function-paren-newline": "off",
1603
+ "generator-star-spacing": "off",
1604
+ "global-require": "off",
1605
+ "handle-callback-err": "off",
1606
+ "id-blacklist": "off",
1607
+ "implicit-arrow-linebreak": "off",
1608
+ indent: "off",
1609
+ "indent-legacy": "off",
1610
+ "jsx-quotes": "off",
1611
+ "key-spacing": "off",
1612
+ "keyword-spacing": "off",
1613
+ "line-comment-position": "off",
1614
+ "linebreak-style": "off",
1615
+ "lines-around-comment": "off",
1616
+ "lines-around-directive": "off",
1617
+ "lines-between-class-members": "off",
1618
+ "max-len": "off",
1619
+ "max-statements-per-line": "off",
1620
+ "multiline-comment-style": "off",
1621
+ "multiline-ternary": "off",
1622
+ "new-parens": "off",
1623
+ "newline-after-var": "off",
1624
+ "newline-before-return": "off",
1625
+ "newline-per-chained-call": "off",
1626
+ "no-buffer-constructor": "off",
1627
+ "no-catch-shadow": "off",
1628
+ "no-confusing-arrow": "off",
1629
+ "no-extra-parens": "off",
1630
+ "no-extra-semi": "off",
1631
+ "no-floating-decimal": "off",
1632
+ "no-mixed-operators": "off",
1633
+ "no-mixed-requires": "off",
1634
+ "no-mixed-spaces-and-tabs": "off",
1635
+ "no-multi-spaces": "off",
1636
+ "no-multiple-empty-lines": "off",
1637
+ "no-native-reassign": "off",
1638
+ "no-negated-in-lhs": "off",
1639
+ "no-new-object": "off",
1640
+ "no-new-require": "off",
1641
+ "no-new-symbol": "off",
1642
+ "no-path-concat": "off",
1643
+ "no-process-env": "off",
1644
+ "no-process-exit": "off",
1645
+ "no-restricted-modules": "off",
1646
+ "no-return-await": "off",
1647
+ "no-spaced-func": "off",
1648
+ "no-sync": "off",
1649
+ "no-tabs": "off",
1650
+ "no-trailing-spaces": "off",
1651
+ "no-whitespace-before-property": "off",
1652
+ "nonblock-statement-body-position": "off",
1653
+ "object-curly-newline": "off",
1654
+ "object-curly-spacing": "off",
1655
+ "object-property-newline": "off",
1656
+ "one-var-declaration-per-line": "off",
1657
+ "operator-linebreak": "off",
1658
+ "padded-blocks": "off",
1659
+ "padding-line-between-statements": "off",
1660
+ "prefer-reflect": "off",
1661
+ "quote-props": "off",
1662
+ quotes: "off",
1663
+ "rest-spread-spacing": "off",
1664
+ semi: "off",
1665
+ "semi-spacing": "off",
1666
+ "semi-style": "off",
1667
+ "space-before-blocks": "off",
1668
+ "space-before-function-paren": "off",
1669
+ "space-in-parens": "off",
1670
+ "space-infix-ops": "off",
1671
+ "space-unary-ops": "off",
1672
+ "spaced-comment": "off",
1673
+ "switch-colon-spacing": "off",
1674
+ "template-curly-spacing": "off",
1675
+ "template-tag-spacing": "off",
1676
+ "wrap-iife": "off",
1677
+ "wrap-regex": "off",
1678
+ "yield-star-spacing": "off",
1587
1679
  },
1588
1680
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethang/eslint-config",
3
- "version": "19.0.10",
3
+ "version": "19.0.11",
4
4
  "repository": {
5
5
  "url": "git+https://github.com/eglove/eslint-config-ethang.git"
6
6
  },
package/setup/astro.js ADDED
@@ -0,0 +1,7 @@
1
+ import astro from "eslint-plugin-astro";
2
+ import { genRules } from "./gen-rules.js";
3
+
4
+ const ruleNames = Object.keys(astro.rules);
5
+ const customRules = [{ name: "no-set-html-directive", rule: 'off"' }];
6
+
7
+ export const astroRules = genRules(ruleNames, customRules, "astro");
@@ -0,0 +1,105 @@
1
+ import { genRules } from "./gen-rules.js";
2
+
3
+ const ruleNames = [
4
+ "array-bracket-newline",
5
+ "array-bracket-spacing",
6
+ "array-element-newline",
7
+ "arrow-parens",
8
+ "arrow-spacing",
9
+ "block-spacing",
10
+ "brace-style",
11
+ "callback-return",
12
+ "comma-dangle",
13
+ "comma-spacing",
14
+ "comma-style",
15
+ "computed-property-spacing",
16
+ "dot-location",
17
+ "eol-last",
18
+ "func-call-spacing",
19
+ "function-call-argument-newline",
20
+ "function-paren-newline",
21
+ "generator-star-spacing",
22
+ "global-require",
23
+ "handle-callback-err",
24
+ "id-blacklist",
25
+ "implicit-arrow-linebreak",
26
+ "indent",
27
+ "indent-legacy",
28
+ "jsx-quotes",
29
+ "key-spacing",
30
+ "keyword-spacing",
31
+ "line-comment-position",
32
+ "linebreak-style",
33
+ "lines-around-comment",
34
+ "lines-around-directive",
35
+ "lines-between-class-members",
36
+ "max-len",
37
+ "max-statements-per-line",
38
+ "multiline-comment-style",
39
+ "multiline-ternary",
40
+ "new-parens",
41
+ "newline-after-var",
42
+ "newline-before-return",
43
+ "newline-per-chained-call",
44
+ "no-buffer-constructor",
45
+ "no-catch-shadow",
46
+ "no-confusing-arrow",
47
+ "no-extra-parens",
48
+ "no-extra-semi",
49
+ "no-floating-decimal",
50
+ "no-mixed-operators",
51
+ "no-mixed-requires",
52
+ "no-mixed-spaces-and-tabs",
53
+ "no-multi-spaces",
54
+ "no-multiple-empty-lines",
55
+ "no-native-reassign",
56
+ "no-negated-in-lhs",
57
+ "no-new-object",
58
+ "no-new-require",
59
+ "no-new-symbol",
60
+ "no-path-concat",
61
+ "no-process-env",
62
+ "no-process-exit",
63
+ "no-restricted-modules",
64
+ "no-return-await",
65
+ "no-spaced-func",
66
+ "no-sync",
67
+ "no-tabs",
68
+ "no-trailing-spaces",
69
+ "no-whitespace-before-property",
70
+ "nonblock-statement-body-position",
71
+ "object-curly-newline",
72
+ "object-curly-spacing",
73
+ "object-property-newline",
74
+ "one-var-declaration-per-line",
75
+ "operator-linebreak",
76
+ "padded-blocks",
77
+ "padding-line-between-statements",
78
+ "prefer-reflect",
79
+ "quote-props",
80
+ "quotes",
81
+ "rest-spread-spacing",
82
+ "semi",
83
+ "semi-spacing",
84
+ "semi-style",
85
+ "space-before-blocks",
86
+ "space-before-function-paren",
87
+ "space-in-parens",
88
+ "space-infix-ops",
89
+ "space-unary-ops",
90
+ "spaced-comment",
91
+ "switch-colon-spacing",
92
+ "template-curly-spacing",
93
+ "template-tag-spacing",
94
+ "wrap-iife",
95
+ "wrap-regex",
96
+ "yield-star-spacing",
97
+ ];
98
+ const customRules = [];
99
+
100
+ export const deprecatedRules = genRules(
101
+ ruleNames,
102
+ customRules,
103
+ undefined,
104
+ "off",
105
+ );
@@ -2,16 +2,17 @@
2
2
  * @param {Array<String>} ruleNames
3
3
  * @param {Array<{name: string, rule: unknown}>} customRules
4
4
  * @param {string?} prefix
5
+ * @param {string?} defaultOverride
5
6
  * @return {Object}
6
7
  */
7
- export const genRules = (ruleNames, customRules, prefix) => {
8
+ export const genRules = (ruleNames, customRules, prefix, defaultOverride) => {
8
9
  const rules = {};
9
10
 
10
11
  for (const rule of ruleNames) {
11
12
  if (prefix === undefined) {
12
- rules[rule] = "error";
13
+ rules[rule] = defaultOverride ?? "error";
13
14
  } else {
14
- rules[`${prefix}/${rule}`] = "error";
15
+ rules[`${prefix}/${rule}`] = defaultOverride ?? "error";
15
16
  }
16
17
  }
17
18
 
package/setup/react.js ADDED
@@ -0,0 +1,30 @@
1
+ import react from "@eslint-react/eslint-plugin";
2
+ import reactHooks from "eslint-plugin-react-hooks";
3
+ import { genRules } from "./gen-rules.js";
4
+
5
+ const reactRuleNames = Object.keys(react.rules);
6
+ const customReactRules = [
7
+ { name: "avoid-shorthand-boolean", rule: "off" },
8
+ { name: "avoid-shorthand-fragment", rule: "off" },
9
+ { name: "debug/class-component", rule: "off" },
10
+ { name: "debug/function-component", rule: "off" },
11
+ { name: "debug/is-from-react", rule: "off" },
12
+ { name: "debug/react-hooks", rule: "off" },
13
+ {
14
+ name: "naming-convention/filename",
15
+ rule: ["error", { rule: "kebab-case" }],
16
+ },
17
+ ];
18
+ const reactGen = genRules(reactRuleNames, customReactRules, "react");
19
+
20
+ const reactHookRuleNames = Object.keys(reactHooks.rules);
21
+ const customHookRules = [
22
+ { name: "exhaustive-deps", rule: "off" }, // TODO fix w/ v9 compatibility
23
+ { name: "rules-of-hooks", rule: "off" }, // TODO fix w/ v9 compatibility
24
+ ];
25
+ const hookGen = genRules(reactHookRuleNames, customHookRules, "react-hooks");
26
+
27
+ export const reactRules = {
28
+ ...hookGen,
29
+ ...reactGen,
30
+ };
package/setup/solid.js ADDED
@@ -0,0 +1,10 @@
1
+ import solid from "eslint-plugin-solid";
2
+ import { genRules } from "./gen-rules.js";
3
+
4
+ const ruleNames = Object.keys(solid.rules);
5
+ const customRules = [
6
+ { name: "no-proxy-apis", rule: "off" },
7
+ { name: "prefer-classlist", rule: "off" },
8
+ ];
9
+
10
+ export const solidRules = genRules(ruleNames, customRules, "solid");