Command-line interface for interactive ESLint configuration setup with support for different configuration modes and legacy formats.
The main CLI executable handles command-line arguments and orchestrates the configuration generation process.
/**
* Main CLI entry point that processes command-line arguments
* Supports interactive mode and direct configuration modes
* Located at: bin/create-config.js
*/Command Line Options:
--config <package-name>: Use specific shared configuration package--eslintrc --config <package-name>: Generate legacy eslintrc-style configurationUsage Examples:
# Interactive mode - asks questions about project setup
npx @eslint/create-config@latest
# Use a specific shared config (flat config format)
npx @eslint/create-config@latest -- --config eslint-config-standard
# Use a specific shared config (legacy eslintrc format)
npx @eslint/create-config@latest -- --eslintrc --config eslint-config-standard
# Use scoped package
npx @eslint/create-config@latest -- --config @company/eslint-config
# Alternative using npm init
npm init @eslint/config@latest -- --config eslint-config-airbnbWhen run without arguments, the CLI launches an interactive setup process:
When --config flag is provided:
--eslintrc flag presenceThe CLI handles several error conditions:
// Package.json validation
if (packageJsonPath === null) {
throw new Error("A package.json file is necessary to initialize ESLint. Run `npm init` to create a package.json file and try again.");
}Common error scenarios:
The CLI follows this execution flow:
0: Successful configuration creation1: Error during execution (missing package.json, configuration errors, etc.)