@eslint-config-snapshot/cli 1.1.0 → 1.1.1

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,13 @@
1
1
  # @eslint-config-snapshot/cli
2
2
 
3
+ ## 1.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Patch release: improve OSS compatibility workflow checks and align CLI zero-config print tolerance.
8
+ - Updated dependencies
9
+ - @eslint-config-snapshot/api@1.1.1
10
+
3
11
  ## 1.1.0
4
12
 
5
13
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -660,9 +660,10 @@ async function executeCheck(cwd, format, terminal, snapshotDir, defaultInvocatio
660
660
  let currentSnapshots;
661
661
  const skippedWorkspaces = [];
662
662
  let discoveredWorkspaces = [];
663
+ const allowWorkspaceExtractionFailure = !foundConfig || isDefaultEquivalentConfig(foundConfig.config);
663
664
  try {
664
665
  currentSnapshots = await computeCurrentSnapshots(cwd, {
665
- allowWorkspaceExtractionFailure: !foundConfig,
666
+ allowWorkspaceExtractionFailure,
666
667
  onWorkspacesDiscovered: (workspacesRel) => {
667
668
  discoveredWorkspaces = workspacesRel;
668
669
  },
@@ -781,6 +782,9 @@ function isWorkspaceDiscoveryDefaultsError(error) {
781
782
  const message = error instanceof Error ? error.message : String(error);
782
783
  return message.includes("Unable to discover workspaces") || message.includes("Unmatched workspaces") || message.includes("zero-config mode");
783
784
  }
785
+ function isDefaultEquivalentConfig(config) {
786
+ return JSON.stringify(config) === JSON.stringify(import_api3.DEFAULT_CONFIG);
787
+ }
784
788
  function writeDiscoveredWorkspacesSummary(terminal, workspacesRel) {
785
789
  if (workspacesRel.length === 0) {
786
790
  terminal.subtle("Auto-discovered workspaces: none\n");
@@ -799,7 +803,8 @@ async function executePrint(cwd, terminal, snapshotDir, format) {
799
803
  if (terminal.showProgress) {
800
804
  terminal.subtle("\u{1F50E} Checking current ESLint configuration...\n");
801
805
  }
802
- const currentSnapshots = await computeCurrentSnapshots(cwd);
806
+ const allowWorkspaceExtractionFailure = !foundConfig || isDefaultEquivalentConfig2(foundConfig.config);
807
+ const currentSnapshots = await computeCurrentSnapshots(cwd, { allowWorkspaceExtractionFailure });
803
808
  if (format === "short") {
804
809
  terminal.write(formatShortPrint([...currentSnapshots.values()]));
805
810
  return;
@@ -838,6 +843,9 @@ async function executeConfig(cwd, terminal, snapshotDir, format) {
838
843
  terminal.write(`${JSON.stringify(payload, null, 2)}
839
844
  `);
840
845
  }
846
+ function isDefaultEquivalentConfig2(config) {
847
+ return JSON.stringify(config) === JSON.stringify(import_api4.DEFAULT_CONFIG);
848
+ }
841
849
 
842
850
  // src/commands/update.ts
843
851
  var import_api5 = require("@eslint-config-snapshot/api");
@@ -856,9 +864,10 @@ async function executeUpdate(cwd, terminal, snapshotDir, printSummary) {
856
864
  let currentSnapshots;
857
865
  const skippedWorkspaces = [];
858
866
  let discoveredWorkspaces = [];
867
+ const allowWorkspaceExtractionFailure = !foundConfig || isDefaultEquivalentConfig3(foundConfig.config);
859
868
  try {
860
869
  currentSnapshots = await computeCurrentSnapshots(cwd, {
861
- allowWorkspaceExtractionFailure: !foundConfig,
870
+ allowWorkspaceExtractionFailure,
862
871
  onWorkspacesDiscovered: (workspacesRel) => {
863
872
  discoveredWorkspaces = workspacesRel;
864
873
  },
@@ -897,6 +906,9 @@ function isWorkspaceDiscoveryDefaultsError2(error) {
897
906
  const message = error instanceof Error ? error.message : String(error);
898
907
  return message.includes("Unable to discover workspaces") || message.includes("Unmatched workspaces") || message.includes("zero-config mode");
899
908
  }
909
+ function isDefaultEquivalentConfig3(config) {
910
+ return JSON.stringify(config) === JSON.stringify(import_api5.DEFAULT_CONFIG);
911
+ }
900
912
  function writeDiscoveredWorkspacesSummary2(terminal, workspacesRel) {
901
913
  if (workspacesRel.length === 0) {
902
914
  terminal.subtle("Auto-discovered workspaces: none\n");
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import createDebug2 from "debug";
6
6
  import path5 from "path";
7
7
 
8
8
  // src/commands/check.ts
9
- import { findConfigPath } from "@eslint-config-snapshot/api";
9
+ import { DEFAULT_CONFIG, findConfigPath } from "@eslint-config-snapshot/api";
10
10
 
11
11
  // src/formatters.ts
12
12
  function formatDiff(groupId, diff) {
@@ -638,9 +638,10 @@ async function executeCheck(cwd, format, terminal, snapshotDir, defaultInvocatio
638
638
  let currentSnapshots;
639
639
  const skippedWorkspaces = [];
640
640
  let discoveredWorkspaces = [];
641
+ const allowWorkspaceExtractionFailure = !foundConfig || isDefaultEquivalentConfig(foundConfig.config);
641
642
  try {
642
643
  currentSnapshots = await computeCurrentSnapshots(cwd, {
643
- allowWorkspaceExtractionFailure: !foundConfig,
644
+ allowWorkspaceExtractionFailure,
644
645
  onWorkspacesDiscovered: (workspacesRel) => {
645
646
  discoveredWorkspaces = workspacesRel;
646
647
  },
@@ -759,6 +760,9 @@ function isWorkspaceDiscoveryDefaultsError(error) {
759
760
  const message = error instanceof Error ? error.message : String(error);
760
761
  return message.includes("Unable to discover workspaces") || message.includes("Unmatched workspaces") || message.includes("zero-config mode");
761
762
  }
763
+ function isDefaultEquivalentConfig(config) {
764
+ return JSON.stringify(config) === JSON.stringify(DEFAULT_CONFIG);
765
+ }
762
766
  function writeDiscoveredWorkspacesSummary(terminal, workspacesRel) {
763
767
  if (workspacesRel.length === 0) {
764
768
  terminal.subtle("Auto-discovered workspaces: none\n");
@@ -769,7 +773,7 @@ function writeDiscoveredWorkspacesSummary(terminal, workspacesRel) {
769
773
  }
770
774
 
771
775
  // src/commands/print.ts
772
- import { findConfigPath as findConfigPath2, loadConfig as loadConfig2 } from "@eslint-config-snapshot/api";
776
+ import { DEFAULT_CONFIG as DEFAULT_CONFIG2, findConfigPath as findConfigPath2, loadConfig as loadConfig2 } from "@eslint-config-snapshot/api";
773
777
  async function executePrint(cwd, terminal, snapshotDir, format) {
774
778
  const foundConfig = await findConfigPath2(cwd);
775
779
  const storedSnapshots = await loadStoredSnapshots(cwd, snapshotDir);
@@ -777,7 +781,8 @@ async function executePrint(cwd, terminal, snapshotDir, format) {
777
781
  if (terminal.showProgress) {
778
782
  terminal.subtle("\u{1F50E} Checking current ESLint configuration...\n");
779
783
  }
780
- const currentSnapshots = await computeCurrentSnapshots(cwd);
784
+ const allowWorkspaceExtractionFailure = !foundConfig || isDefaultEquivalentConfig2(foundConfig.config);
785
+ const currentSnapshots = await computeCurrentSnapshots(cwd, { allowWorkspaceExtractionFailure });
781
786
  if (format === "short") {
782
787
  terminal.write(formatShortPrint([...currentSnapshots.values()]));
783
788
  return;
@@ -816,9 +821,12 @@ async function executeConfig(cwd, terminal, snapshotDir, format) {
816
821
  terminal.write(`${JSON.stringify(payload, null, 2)}
817
822
  `);
818
823
  }
824
+ function isDefaultEquivalentConfig2(config) {
825
+ return JSON.stringify(config) === JSON.stringify(DEFAULT_CONFIG2);
826
+ }
819
827
 
820
828
  // src/commands/update.ts
821
- import { findConfigPath as findConfigPath3 } from "@eslint-config-snapshot/api";
829
+ import { DEFAULT_CONFIG as DEFAULT_CONFIG3, findConfigPath as findConfigPath3 } from "@eslint-config-snapshot/api";
822
830
  async function executeUpdate(cwd, terminal, snapshotDir, printSummary) {
823
831
  const foundConfig = await findConfigPath3(cwd);
824
832
  const storedSnapshots = await loadStoredSnapshots(cwd, snapshotDir);
@@ -834,9 +842,10 @@ async function executeUpdate(cwd, terminal, snapshotDir, printSummary) {
834
842
  let currentSnapshots;
835
843
  const skippedWorkspaces = [];
836
844
  let discoveredWorkspaces = [];
845
+ const allowWorkspaceExtractionFailure = !foundConfig || isDefaultEquivalentConfig3(foundConfig.config);
837
846
  try {
838
847
  currentSnapshots = await computeCurrentSnapshots(cwd, {
839
- allowWorkspaceExtractionFailure: !foundConfig,
848
+ allowWorkspaceExtractionFailure,
840
849
  onWorkspacesDiscovered: (workspacesRel) => {
841
850
  discoveredWorkspaces = workspacesRel;
842
851
  },
@@ -875,6 +884,9 @@ function isWorkspaceDiscoveryDefaultsError2(error) {
875
884
  const message = error instanceof Error ? error.message : String(error);
876
885
  return message.includes("Unable to discover workspaces") || message.includes("Unmatched workspaces") || message.includes("zero-config mode");
877
886
  }
887
+ function isDefaultEquivalentConfig3(config) {
888
+ return JSON.stringify(config) === JSON.stringify(DEFAULT_CONFIG3);
889
+ }
878
890
  function writeDiscoveredWorkspacesSummary2(terminal, workspacesRel) {
879
891
  if (workspacesRel.length === 0) {
880
892
  terminal.subtle("Auto-discovered workspaces: none\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-config-snapshot/cli",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -31,6 +31,6 @@
31
31
  "commander": "^14.0.3",
32
32
  "debug": "^4.4.3",
33
33
  "fast-glob": "^3.3.3",
34
- "@eslint-config-snapshot/api": "1.1.0"
34
+ "@eslint-config-snapshot/api": "1.1.1"
35
35
  }
36
36
  }
@@ -1,4 +1,4 @@
1
- import { findConfigPath } from '@eslint-config-snapshot/api'
1
+ import { DEFAULT_CONFIG, findConfigPath, type SnapshotConfig } from '@eslint-config-snapshot/api'
2
2
 
3
3
  import {
4
4
  countUniqueWorkspaces,
@@ -53,9 +53,10 @@ export async function executeCheck(
53
53
  let currentSnapshots: Map<string, BuiltSnapshot>
54
54
  const skippedWorkspaces: SkippedWorkspace[] = []
55
55
  let discoveredWorkspaces: string[] = []
56
+ const allowWorkspaceExtractionFailure = !foundConfig || isDefaultEquivalentConfig(foundConfig.config)
56
57
  try {
57
58
  currentSnapshots = await computeCurrentSnapshots(cwd, {
58
- allowWorkspaceExtractionFailure: !foundConfig,
59
+ allowWorkspaceExtractionFailure,
59
60
  onWorkspacesDiscovered: (workspacesRel) => {
60
61
  discoveredWorkspaces = workspacesRel
61
62
  },
@@ -186,6 +187,10 @@ function isWorkspaceDiscoveryDefaultsError(error: unknown): boolean {
186
187
  )
187
188
  }
188
189
 
190
+ function isDefaultEquivalentConfig(config: SnapshotConfig): boolean {
191
+ return JSON.stringify(config) === JSON.stringify(DEFAULT_CONFIG)
192
+ }
193
+
189
194
  function writeDiscoveredWorkspacesSummary(terminal: TerminalIO, workspacesRel: string[]): void {
190
195
  if (workspacesRel.length === 0) {
191
196
  terminal.subtle('Auto-discovered workspaces: none\n')
@@ -1,4 +1,4 @@
1
- import { findConfigPath, loadConfig } from '@eslint-config-snapshot/api'
1
+ import { DEFAULT_CONFIG, findConfigPath, loadConfig, type SnapshotConfig } from '@eslint-config-snapshot/api'
2
2
 
3
3
  import { formatShortConfig, formatShortPrint } from '../formatters.js'
4
4
  import { writeRunContextHeader } from '../run-context.js'
@@ -14,7 +14,8 @@ export async function executePrint(cwd: string, terminal: TerminalIO, snapshotDi
14
14
  if (terminal.showProgress) {
15
15
  terminal.subtle('🔎 Checking current ESLint configuration...\n')
16
16
  }
17
- const currentSnapshots = await computeCurrentSnapshots(cwd)
17
+ const allowWorkspaceExtractionFailure = !foundConfig || isDefaultEquivalentConfig(foundConfig.config)
18
+ const currentSnapshots = await computeCurrentSnapshots(cwd, { allowWorkspaceExtractionFailure })
18
19
 
19
20
  if (format === 'short') {
20
21
  terminal.write(formatShortPrint([...currentSnapshots.values()]))
@@ -56,3 +57,7 @@ export async function executeConfig(cwd: string, terminal: TerminalIO, snapshotD
56
57
 
57
58
  terminal.write(`${JSON.stringify(payload, null, 2)}\n`)
58
59
  }
60
+
61
+ function isDefaultEquivalentConfig(config: SnapshotConfig): boolean {
62
+ return JSON.stringify(config) === JSON.stringify(DEFAULT_CONFIG)
63
+ }
@@ -1,4 +1,4 @@
1
- import { findConfigPath } from '@eslint-config-snapshot/api'
1
+ import { DEFAULT_CONFIG, findConfigPath, type SnapshotConfig } from '@eslint-config-snapshot/api'
2
2
 
3
3
  import { countUniqueWorkspaces, formatBaselineSummaryLines, summarizeSnapshots } from '../formatters.js'
4
4
  import { writeEslintVersionSummary, writeRunContextHeader } from '../run-context.js'
@@ -23,9 +23,10 @@ export async function executeUpdate(cwd: string, terminal: TerminalIO, snapshotD
23
23
  let currentSnapshots
24
24
  const skippedWorkspaces: SkippedWorkspace[] = []
25
25
  let discoveredWorkspaces: string[] = []
26
+ const allowWorkspaceExtractionFailure = !foundConfig || isDefaultEquivalentConfig(foundConfig.config)
26
27
  try {
27
28
  currentSnapshots = await computeCurrentSnapshots(cwd, {
28
- allowWorkspaceExtractionFailure: !foundConfig,
29
+ allowWorkspaceExtractionFailure,
29
30
  onWorkspacesDiscovered: (workspacesRel) => {
30
31
  discoveredWorkspaces = workspacesRel
31
32
  },
@@ -72,6 +73,10 @@ function isWorkspaceDiscoveryDefaultsError(error: unknown): boolean {
72
73
  )
73
74
  }
74
75
 
76
+ function isDefaultEquivalentConfig(config: SnapshotConfig): boolean {
77
+ return JSON.stringify(config) === JSON.stringify(DEFAULT_CONFIG)
78
+ }
79
+
75
80
  function writeDiscoveredWorkspacesSummary(terminal: TerminalIO, workspacesRel: string[]): void {
76
81
  if (workspacesRel.length === 0) {
77
82
  terminal.subtle('Auto-discovered workspaces: none\n')
@@ -142,6 +142,36 @@ describe.sequential('cli integration', () => {
142
142
  })
143
143
  })
144
144
 
145
+ it('update treats explicit empty package config as zero-config tolerant mode', async () => {
146
+ await rm(path.join(fixtureRoot, 'eslint-config-snapshot.config.mjs'), { force: true })
147
+ const packageJsonPath = path.join(fixtureRoot, 'package.json')
148
+ const packageJsonRaw = await readFile(packageJsonPath, 'utf8')
149
+ const packageJson = JSON.parse(packageJsonRaw) as Record<string, unknown>
150
+ packageJson['eslint-config-snapshot'] = {}
151
+ await writeFile(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`)
152
+
153
+ await writeFile(
154
+ path.join(fixtureRoot, 'packages/ws-b/node_modules/eslint/bin/eslint.js'),
155
+ "console.error('Failed to load config \"next/core-web-vitals\" to extend from.'); process.exit(1)\n"
156
+ )
157
+
158
+ const code = await runCli('update', fixtureRoot)
159
+ expect(code).toBe(0)
160
+
161
+ const snapshotRaw = await readFile(path.join(fixtureRoot, '.eslint-config-snapshot/default.json'), 'utf8')
162
+ const snapshot = JSON.parse(snapshotRaw)
163
+
164
+ expect(snapshot).toEqual({
165
+ formatVersion: 1,
166
+ groupId: 'default',
167
+ workspaces: ['packages/ws-a'],
168
+ rules: {
169
+ eqeqeq: ['error', 'always'],
170
+ 'no-console': ['warn']
171
+ }
172
+ })
173
+ })
174
+
145
175
  it('status is minimal and exits 0 when clean', async () => {
146
176
  await runCli('snapshot', fixtureRoot)
147
177