@ethang/eslint-config 19.2.1 → 19.2.3

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.
@@ -0,0 +1,4 @@
1
+ export async function getLatestReact() {
2
+ const response = await fetch("https://registry.npmjs.org/react/latest");
3
+ return response.json();
4
+ }
@@ -2,7 +2,7 @@ import { writeFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { astroRules } from "../setup/astro.js";
4
4
 
5
- export const updateAstroRules = async () => {
5
+ export const updateAstroRules = () => {
6
6
  let configFile = "";
7
7
 
8
8
  const rulesJson = JSON.stringify(astroRules).slice(1, -1);
@@ -1,9 +1,14 @@
1
1
  import { reactRules } from "../setup/react.js";
2
2
  import { writeFileSync } from "node:fs";
3
3
  import { join } from "node:path";
4
+ import { getLatestReact } from "./get-react-version.mjs";
4
5
 
5
6
  export const updateReactRules = async () => {
6
7
  let configFile = "";
8
+ const react = await getLatestReact();
9
+ const settings = JSON.stringify({
10
+ react: { version: react.version },
11
+ }).slice(1, -1);
7
12
 
8
13
  const rulesJson = JSON.stringify(reactRules).slice(1, -1);
9
14
 
@@ -29,6 +34,9 @@ export const updateReactRules = async () => {
29
34
  react,
30
35
  "react-hooks": reactHooks,
31
36
  },
37
+ settings: {
38
+ ${settings}
39
+ },
32
40
  rules: {
33
41
  ${rulesJson}
34
42
  },
@@ -21,7 +21,7 @@ import { astroRules } from "../setup/astro.js";
21
21
  import { reactRules } from "../setup/react.js";
22
22
  import { solidRules } from "../setup/solid.js";
23
23
 
24
- export const updateReadme = async () => {
24
+ export const updateReadme = () => {
25
25
  const md = new MarkdownGenerator();
26
26
  md.header(1, "Opinionated, Strict, Brutal, Unforgiving", 2);
27
27
  md.link("View Config", "https://eslint-config-ethang.pages.dev/rules", 2);
@@ -17,9 +17,14 @@ import { join } from "node:path";
17
17
  import { deprecatedRules } from "../setup/deprecated.js";
18
18
  import { markdownRules } from "../setup/markdown.js";
19
19
  import { jsonRules } from "../setup/json.js";
20
+ import { getLatestReact } from "./get-react-version.mjs";
20
21
 
21
22
  export const updateRules = async () => {
22
23
  let configFile = "";
24
+ const react = await getLatestReact();
25
+ const settings = JSON.stringify({
26
+ react: { version: react.version },
27
+ }).slice(1, -1);
23
28
 
24
29
  const jsRules = {
25
30
  ...dependRules,
@@ -82,6 +87,9 @@ export default tseslint.config(
82
87
  files: ["**/*.{js,ts,jsx,tsx,cjs,cts,mjs,mts}"],
83
88
  ignores,
84
89
  languageOptions,
90
+ settings: {
91
+ ${settings}
92
+ },
85
93
  plugins: {
86
94
  "@tanstack/query": tanstack,
87
95
  "@typescript-eslint": tseslint.plugin,
@@ -119,7 +127,7 @@ export default tseslint.config(
119
127
  },
120
128
  );\n`;
121
129
 
122
- await writeFileSync(
130
+ writeFileSync(
123
131
  join(import.meta.dirname, "../eslint.config.js"),
124
132
  configFile,
125
133
  "utf8",
@@ -2,7 +2,7 @@ import { solidRules } from "../setup/solid.js";
2
2
  import { writeFileSync } from "node:fs";
3
3
  import { join } from "node:path";
4
4
 
5
- export const updateSolidRules = async () => {
5
+ export const updateSolidRules = () => {
6
6
  let configFile = "";
7
7
 
8
8
  const rulesJson = JSON.stringify(solidRules).slice(1, -1);
@@ -31,7 +31,7 @@ export const updateSolidRules = async () => {
31
31
  });
32
32
  `;
33
33
 
34
- await writeFileSync(
34
+ writeFileSync(
35
35
  join(import.meta.dirname, "../config.solid.js"),
36
36
  configFile,
37
37
  "utf8",
package/build.mjs CHANGED
@@ -10,13 +10,12 @@ await projectBuilder("eslint-config-ethang", "master", {
10
10
  isLibrary: true,
11
11
  scripts: ["UPDATE", "DEDUPE", "LINT"],
12
12
  postInstall: async () => {
13
- await Promise.all([
14
- updateRules(),
15
- updateReactRules(),
16
- updateSolidRules(),
17
- updateAstroRules(),
18
- updateReadme(),
19
- ]);
13
+ console.log("Updating Rules...");
14
+ await updateRules();
15
+ await updateReactRules();
16
+ updateSolidRules();
17
+ updateAstroRules();
18
+ updateReadme();
20
19
  },
21
20
  tsupOptions: {
22
21
  bundle: true,
package/config.react.js CHANGED
@@ -12,6 +12,9 @@ export default tseslint.config({
12
12
  react,
13
13
  "react-hooks": reactHooks,
14
14
  },
15
+ settings: {
16
+ react: { version: "18.3.1" },
17
+ },
15
18
  rules: {
16
19
  "react-hooks/rules-of-hooks": "off",
17
20
  "react-hooks/exhaustive-deps": "off",
package/eslint.config.js CHANGED
@@ -29,6 +29,9 @@ export default tseslint.config(
29
29
  files: ["**/*.{js,ts,jsx,tsx,cjs,cts,mjs,mts}"],
30
30
  ignores,
31
31
  languageOptions,
32
+ settings: {
33
+ react: { version: "18.3.1" },
34
+ },
32
35
  plugins: {
33
36
  "@tanstack/query": tanstack,
34
37
  "@typescript-eslint": tseslint.plugin,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethang/eslint-config",
3
- "version": "19.2.1",
3
+ "version": "19.2.3",
4
4
  "repository": {
5
5
  "url": "git+https://github.com/eglove/eslint-config-ethang.git"
6
6
  },
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "@ethang/markdown-generator": "^1.1.1",
42
- "@ethang/project-builder": "^2.5.0",
42
+ "@ethang/project-builder": "^2.5.1",
43
43
  "@tsconfig/node-lts": "^20.1.3",
44
44
  "@tsconfig/strictest": "^2.0.5",
45
45
  "prettier": "^3.3.3"