Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
}
},
"devDependencies": {
"@babel/types": "^7.25.0",
"@commitlint/cli": "^20.5.0",
"@commitlint/config-conventional": "^20.5.0",
"@commitlint/config-nx-scopes": "^20.5.0",
Expand Down Expand Up @@ -59,6 +60,7 @@
"jsonc-eslint-parser": "^3.1.0",
"nx": "22.6.4",
"prettier": "~3.6.2",
"recast": "^0.23.11",
"semver": "^7.7.4",
"tslib": "^2.3.0",
"typescript": "^5.6.3",
Expand Down
10 changes: 10 additions & 0 deletions packages/create-eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,18 @@
},
"homepage": "https://github.com/code-pushup/eslint-config/tree/main/packages/create-eslint-config#readme",
"dependencies": {
"@babel/types": "^7.25.0",
"@inquirer/prompts": "^8.4.1",
"recast": "^0.23.11",
"semver": "^7.7.4",
"yargs": "^18.0.0"
},
"peerDependencies": {
"prettier": "^3.0.0"
},
"peerDependenciesMeta": {
"prettier": {
"optional": true
}
}
}
25 changes: 3 additions & 22 deletions packages/create-eslint-config/src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import path from 'node:path';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import { logError, formatError, logChanges, logInfo } from './lib/output.js';
import {
detectPackageManager,
installDependencies,
} from './lib/package-manager.js';
import { validateConfigSlugs } from './lib/prompts.js';
import { NODE_VERSION_SOURCES } from './lib/types.js';
import { runSetupWizard } from './lib/wizard.js';

Expand Down Expand Up @@ -42,12 +40,6 @@ const argv = await yargs(hideBin(process.argv))
default: false,
describe: 'Show what would happen without writing or installing',
})
.check(parsed => {
if (parsed.configs) {
validateConfigSlugs(parsed.configs);
}
return true;
})
.strict()
.help()
.version()
Expand All @@ -68,7 +60,7 @@ try {
logChanges(result.files);

if (argv.dryRun) {
logInfo('Dry run — no files written.');
logInfo('Dry run. No files written.');
} else {
await result.flush();
const manager = await detectPackageManager(targetDir);
Expand All @@ -83,21 +75,10 @@ try {
process.exitCode = 1;
}
}

// TODO: remove snippet output once the wizard can merge into existing configs
if (result.manualSnippet) {
const filename = result.manualSnippetPath
? path.basename(result.manualSnippetPath)
: 'eslint.config.js';
logInfo(
`Existing ${filename} detected. Here are the imports and config entries for your selections — merge manually (v1 will do this automatically):`,
'',
result.manualSnippet,
);
} else if (!argv.dryRun && !process.exitCode) {
if (!argv.dryRun && !process.exitCode) {
logInfo('Next step: run `npx eslint .` to verify the setup.');
}
} catch (error) {
logError(formatError(error));
logError('Setup wizard failed.', formatError(error));
process.exitCode = 1;
}
12 changes: 7 additions & 5 deletions packages/create-eslint-config/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
export { runSetupWizard } from './lib/wizard.js';
export type {
FileChange,
NodeVersionSource,
WizardOptions,
WizardResult,
export { WizardError } from './lib/errors.js';
export {
NODE_VERSION_SOURCES,
type FileChange,
type NodeVersionSource,
type WizardOptions,
type WizardResult,
} from './lib/types.js';
116 changes: 0 additions & 116 deletions packages/create-eslint-config/src/lib/codegen.spec.ts

This file was deleted.

Loading
Loading