@pob/eslint-config-typescript-react 67.4.0 → 67.5.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.
@@ -0,0 +1,51 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import pobConfig from "./index.js";
3
+
4
+ // plugins added by this package, the others are in @pob/eslint-config inventory
5
+ const pluginNames = new Set(["react", "react-hooks", "jsx-a11y"]);
6
+
7
+ describe("eslint rules inventory", () => {
8
+ // New rules and newly deprecated ones of the react plugins show up in the
9
+ // snapshot diff on upgrades. Same format as @pob/eslint-config inventory.
10
+ it("matches the snapshot", async () => {
11
+ const configs = Object.values(pobConfig.configs).flat();
12
+
13
+ /** @type {Map<string, import("eslint").Rule.RuleModule>} */
14
+ const rules = new Map();
15
+ /** @type {Map<string, boolean>} */
16
+ const enabledRules = new Map();
17
+ for (const config of configs) {
18
+ for (const [pluginName, plugin] of Object.entries(config.plugins ?? {})) {
19
+ if (!pluginNames.has(pluginName)) continue;
20
+ for (const [ruleName, rule] of Object.entries(plugin.rules ?? {})) {
21
+ rules.set(
22
+ `${pluginName}/${ruleName}`,
23
+ /** @type {import("eslint").Rule.RuleModule} */ (rule),
24
+ );
25
+ }
26
+ }
27
+ for (const [ruleName, ruleEntry] of Object.entries(config.rules ?? {})) {
28
+ const severity = Array.isArray(ruleEntry) ? ruleEntry[0] : ruleEntry;
29
+ const enabled = severity !== "off" && severity !== 0;
30
+ enabledRules.set(ruleName, enabledRules.get(ruleName) || enabled);
31
+ }
32
+ }
33
+
34
+ /** @type {Record<string, "enabled" | "off" | "unset" | "deprecated">} */
35
+ const status = {};
36
+ for (const ruleName of [...rules.keys()].toSorted()) {
37
+ const enabled = enabledRules.get(ruleName);
38
+ if (rules.get(ruleName)?.meta?.deprecated) {
39
+ if (enabled) status[ruleName] = "deprecated";
40
+ } else if (enabled === undefined) {
41
+ status[ruleName] = "unset";
42
+ } else {
43
+ status[ruleName] = enabled ? "enabled" : "off";
44
+ }
45
+ }
46
+
47
+ await expect(`${JSON.stringify(status, null, 2)}\n`).toMatchFileSnapshot(
48
+ "../inventory/eslint-rules.json",
49
+ );
50
+ });
51
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pob/eslint-config-typescript-react",
3
- "version": "67.4.0",
3
+ "version": "67.5.0",
4
4
  "description": "eslint config files",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/christophehurpeau/pob",
@@ -32,8 +32,8 @@
32
32
  "eslint-plugin-jsx-a11y": "6.10.2",
33
33
  "eslint-plugin-react": "7.37.5",
34
34
  "eslint-plugin-react-hooks": "5.2.0",
35
- "@pob/eslint-config": "67.4.0",
36
- "@pob/eslint-plugin": "66.1.2"
35
+ "@pob/eslint-config": "67.5.0",
36
+ "@pob/eslint-plugin": "66.2.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/node": "24.13.3",
@@ -50,7 +50,8 @@
50
50
  },
51
51
  "pob": {},
52
52
  "scripts": {
53
- "lint": "pnpm run lint:eslint",
54
- "lint:eslint": "pnpm run --dir '../..' eslint --quiet '@pob/eslint-config-typescript-react'"
53
+ "lint": "pnpm run lint:oxlint && pnpm run lint:eslint",
54
+ "lint:eslint": "pnpm --dir '../..' exec eslint --quiet '@pob/eslint-config-typescript-react'",
55
+ "lint:oxlint": "pnpm --dir '../..' exec oxlint '@pob/eslint-config-typescript-react'"
55
56
  }
56
57
  }