@eslint-config-snapshot/api 0.4.0 → 0.6.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @eslint-config-snapshot/api
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Release minor version with improved interactive CLI logging tone and richer runtime context reporting.
8
+
9
+ ## 0.5.0
10
+
11
+ ### Minor Changes
12
+
13
+ - Add ESLint runtime version reporting by group in CLI summaries and improve pnpm/corepack isolated test resilience.
14
+
3
15
  ## 0.4.0
4
16
 
5
17
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -48,6 +48,7 @@ __export(index_exports, {
48
48
  normalizeSeverity: () => normalizeSeverity,
49
49
  readSnapshotFile: () => readSnapshotFile,
50
50
  resolveEslintBinForWorkspace: () => resolveEslintBinForWorkspace,
51
+ resolveEslintVersionForWorkspace: () => resolveEslintVersionForWorkspace,
51
52
  sampleWorkspaceFiles: () => sampleWorkspaceFiles,
52
53
  sortUnique: () => sortUnique,
53
54
  writeSnapshotFile: () => writeSnapshotFile
@@ -356,6 +357,19 @@ function extractRulesFromPrintConfig(workspaceAbs, fileAbs) {
356
357
  const rules = parsed.rules ?? {};
357
358
  return normalizeRules(rules);
358
359
  }
360
+ function resolveEslintVersionForWorkspace(workspaceAbs) {
361
+ const anchor = import_node_path2.default.join(workspaceAbs, "__snapshot_anchor__.cjs");
362
+ const req = (0, import_node_module.createRequire)(anchor);
363
+ try {
364
+ const packageJsonPath = req.resolve("eslint/package.json");
365
+ const packageJson = JSON.parse((0, import_node_fs.readFileSync)(packageJsonPath, "utf8"));
366
+ if (typeof packageJson.version === "string" && packageJson.version.length > 0) {
367
+ return packageJson.version;
368
+ }
369
+ } catch {
370
+ }
371
+ return "unknown";
372
+ }
359
373
  async function extractRulesForWorkspaceSamples(workspaceAbs, fileAbsList) {
360
374
  const evaluate = await createWorkspaceEvaluator(workspaceAbs);
361
375
  const results = [];
@@ -657,6 +671,7 @@ function getConfigScaffold(preset = "minimal") {
657
671
  normalizeSeverity,
658
672
  readSnapshotFile,
659
673
  resolveEslintBinForWorkspace,
674
+ resolveEslintVersionForWorkspace,
660
675
  sampleWorkspaceFiles,
661
676
  sortUnique,
662
677
  writeSnapshotFile
package/dist/index.js CHANGED
@@ -300,6 +300,19 @@ function extractRulesFromPrintConfig(workspaceAbs, fileAbs) {
300
300
  const rules = parsed.rules ?? {};
301
301
  return normalizeRules(rules);
302
302
  }
303
+ function resolveEslintVersionForWorkspace(workspaceAbs) {
304
+ const anchor = path2.join(workspaceAbs, "__snapshot_anchor__.cjs");
305
+ const req = createRequire(anchor);
306
+ try {
307
+ const packageJsonPath = req.resolve("eslint/package.json");
308
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
309
+ if (typeof packageJson.version === "string" && packageJson.version.length > 0) {
310
+ return packageJson.version;
311
+ }
312
+ } catch {
313
+ }
314
+ return "unknown";
315
+ }
303
316
  async function extractRulesForWorkspaceSamples(workspaceAbs, fileAbsList) {
304
317
  const evaluate = await createWorkspaceEvaluator(workspaceAbs);
305
318
  const results = [];
@@ -600,6 +613,7 @@ export {
600
613
  normalizeSeverity,
601
614
  readSnapshotFile,
602
615
  resolveEslintBinForWorkspace,
616
+ resolveEslintVersionForWorkspace,
603
617
  sampleWorkspaceFiles,
604
618
  sortUnique,
605
619
  writeSnapshotFile
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-config-snapshot/api",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
package/src/extract.ts CHANGED
@@ -91,6 +91,23 @@ export function extractRulesFromPrintConfig(workspaceAbs: string, fileAbs: strin
91
91
  return normalizeRules(rules)
92
92
  }
93
93
 
94
+ export function resolveEslintVersionForWorkspace(workspaceAbs: string): string {
95
+ const anchor = path.join(workspaceAbs, '__snapshot_anchor__.cjs')
96
+ const req = createRequire(anchor)
97
+
98
+ try {
99
+ const packageJsonPath = req.resolve('eslint/package.json')
100
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8')) as { version?: string }
101
+ if (typeof packageJson.version === 'string' && packageJson.version.length > 0) {
102
+ return packageJson.version
103
+ }
104
+ } catch {
105
+ // fall through to deterministic unknown marker
106
+ }
107
+
108
+ return 'unknown'
109
+ }
110
+
94
111
  export async function extractRulesForWorkspaceSamples(
95
112
  workspaceAbs: string,
96
113
  fileAbsList: string[]
package/src/index.ts CHANGED
@@ -7,7 +7,12 @@ export type { GroupAssignment, GroupDefinition, WorkspaceDiscovery, WorkspaceInp
7
7
  export { sampleWorkspaceFiles } from './sampling.js'
8
8
  export type { SamplingConfig } from './sampling.js'
9
9
 
10
- export { extractRulesForWorkspaceSamples, extractRulesFromPrintConfig, resolveEslintBinForWorkspace } from './extract.js'
10
+ export {
11
+ extractRulesForWorkspaceSamples,
12
+ extractRulesFromPrintConfig,
13
+ resolveEslintBinForWorkspace,
14
+ resolveEslintVersionForWorkspace
15
+ } from './extract.js'
11
16
  export type { ExtractedWorkspaceRules, NormalizedRuleEntry, WorkspaceExtractionResult } from './extract.js'
12
17
 
13
18
  export { aggregateRules, buildSnapshot, readSnapshotFile, writeSnapshotFile } from './snapshot.js'