@sushichan044/eslint-config-array-resolver 0.1.3 → 0.1.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.
@@ -8,12 +8,6 @@ interface ESLintConfig {
8
8
  dependencies: string[];
9
9
  payload: Payload;
10
10
  }
11
- /**
12
- * Traverse and find the ESLint config file.
13
- *
14
- * @internal
15
- */
16
-
17
11
  interface ReadFlatConfigOptions {
18
12
  suppressOutput?: boolean;
19
13
  }
@@ -63,9 +63,8 @@ const findConfigPath = (root) => {
63
63
  const resolveFlatConfig = async (root, options = {}) => {
64
64
  const { suppressOutput = false } = options;
65
65
  const { basePath, fullPath } = findConfigPath(root);
66
- const moduleImportPromise = runInDirectory(basePath, async () => unrun({ path: fullPath }));
67
- const importPromise = suppressOutput ? executeWithSilentLogs(async () => moduleImportPromise) : moduleImportPromise;
68
- const { dependencies, module: configModule } = await importPromise;
66
+ const startImportConfig = async () => runInDirectory(basePath, async () => unrun({ path: fullPath }));
67
+ const { dependencies, module: configModule } = await (suppressOutput ? executeWithSilentLogs(startImportConfig) : startImportConfig());
69
68
  const rawConfigs = Array.isArray(configModule) ? configModule : [configModule];
70
69
  rawConfigs.unshift({
71
70
  index: 1,
@@ -94,8 +93,7 @@ const resolveFlatConfig = async (root, options = {}) => {
94
93
  name: "eslint/defaults/files-cjs"
95
94
  });
96
95
  const rulesMap = /* @__PURE__ */ new Map();
97
- const eslintPath = await resolve("eslint/use-at-your-own-risk", { url: basePath }).catch(() => null) ?? "eslint/use-at-your-own-risk";
98
- const eslintRules = await import(eslintPath).then((r) => r.default.builtinRules);
96
+ const eslintRules = await import(await resolve("eslint/use-at-your-own-risk", { url: basePath }).catch(() => null) ?? "eslint/use-at-your-own-risk").then((r) => r.default.builtinRules);
99
97
  for (const [name, rule] of eslintRules.entries()) rulesMap.set(name, {
100
98
  ...rule.meta,
101
99
  messages: void 0,
@@ -111,32 +109,30 @@ const resolveFlatConfig = async (root, options = {}) => {
111
109
  schema: void 0
112
110
  });
113
111
  const rules = Object.fromEntries(rulesMap.entries());
114
- const configs = rawConfigs.map((c, index) => {
115
- return {
116
- ...c,
117
- index,
118
- languageOptions: c.languageOptions ? {
119
- ...c.languageOptions,
120
- parser: c.languageOptions.parser?.meta?.name
121
- } : void 0,
122
- plugins: c.plugins ? Object.fromEntries(Object.entries(c.plugins ?? {}).map(([prefix]) => [prefix, {}]).filter((index_) => index_[0])) : void 0,
123
- processor: c.processor?.meta?.name
124
- };
125
- });
126
- const payload = {
127
- configs,
128
- files: null,
129
- meta: {
130
- basePath,
131
- configPath: fullPath,
132
- lastUpdate: Date.now()
133
- },
134
- rules
135
- };
136
112
  return {
137
113
  configs: rawConfigs,
138
114
  dependencies,
139
- payload
115
+ payload: {
116
+ configs: rawConfigs.map((c, index) => {
117
+ return {
118
+ ...c,
119
+ index,
120
+ languageOptions: c.languageOptions ? {
121
+ ...c.languageOptions,
122
+ parser: c.languageOptions.parser?.meta?.name
123
+ } : void 0,
124
+ plugins: c.plugins ? Object.fromEntries(Object.entries(c.plugins ?? {}).map(([prefix]) => [prefix, {}]).filter((index_) => index_[0])) : void 0,
125
+ processor: c.processor?.meta?.name
126
+ };
127
+ }),
128
+ files: null,
129
+ meta: {
130
+ basePath,
131
+ configPath: fullPath,
132
+ lastUpdate: Date.now()
133
+ },
134
+ rules
135
+ }
140
136
  };
141
137
  };
142
138
  export { resolveFlatConfig };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sushichan044/eslint-config-array-resolver",
3
3
  "description": "Resolves flat config module. For internal use only.",
4
- "version": "0.1.3",
4
+ "version": "0.1.4",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "author": {
@@ -18,46 +18,42 @@
18
18
  "registry": "https://registry.npmjs.org/",
19
19
  "provenance": true
20
20
  },
21
- "main": "dist/index.js",
22
- "module": "dist/index.js",
23
- "types": "dist/index.d.ts",
24
21
  "files": [
25
22
  "dist"
26
23
  ],
27
24
  "exports": {
28
25
  ".": {
29
- "types": "./dist/index.d.ts",
30
- "import": "./dist/index.js"
26
+ "types": "./dist/index.d.mts",
27
+ "import": "./dist/index.mjs"
31
28
  }
32
29
  },
33
30
  "devDependencies": {
34
- "@arethetypeswrong/cli": "0.18.2",
35
- "@biomejs/biome": "2.3.4",
36
- "@types/node": "24.1.0",
37
- "@virtual-live-lab/eslint-config": "2.3.1",
38
- "@virtual-live-lab/tsconfig": "2.1.21",
39
- "eslint": "9.39.1",
40
- "fs-fixture": "2.8.1",
41
- "publint": "0.3.12",
42
- "tsdown": "0.13.0",
43
- "typescript": "5.9.3",
44
- "typescript-eslint": "8.46.3",
45
- "unplugin-unused": "0.5.1",
46
- "vitest": "4.0.8"
31
+ "@arethetypeswrong/core": "^0.18.2",
32
+ "@biomejs/biome": "^2.3.4",
33
+ "@types/node": "^24.10.0",
34
+ "@virtual-live-lab/eslint-config": "^2.3.1",
35
+ "@virtual-live-lab/tsconfig": "^2.1.21",
36
+ "eslint": "^9.39.1",
37
+ "fs-fixture": "^2.10.1",
38
+ "publint": "^0.3.15",
39
+ "tsdown": "^0.16.1",
40
+ "typescript": "^5.9.3",
41
+ "typescript-eslint": "^8.46.4",
42
+ "unplugin-unused": "^0.5.6",
43
+ "vitest": "^4.0.8"
47
44
  },
48
45
  "dependencies": {
49
- "@typescript-eslint/utils": "^8.0.0",
46
+ "@typescript-eslint/utils": "^8.46.4",
50
47
  "empathic": "^2.0.0",
51
- "mlly": "^1.7.4",
48
+ "mlly": "^1.8.0",
52
49
  "pathe": "^2.0.3",
53
- "unrun": "^0.2.6"
50
+ "unrun": "^0.2.7"
54
51
  },
55
52
  "scripts": {
56
53
  "lint": "eslint --max-warnings 0 --fix .",
57
54
  "format": "biome format --write .",
58
55
  "typecheck": "tsc --noEmit",
59
56
  "test": "vitest --run",
60
- "build": "tsdown",
61
- "build:check": "pnpm run build && pnpm pack && attw"
57
+ "build": "tsdown"
62
58
  }
63
59
  }