@eslint/create-config
Advanced tools
Comparing version 0.4.6 to 1.0.0
#!/usr/bin/env node | ||
/** | ||
* @fileoverview Main CLI that is run via the eslint command. | ||
* @author Nicholas C. Zakas | ||
* @fileoverview Main CLI that is run via the `npm init @eslint/config` command. | ||
* @author 唯然<weiran.zsd@outlook.com> | ||
*/ | ||
/* eslint no-console:off -- CLI */ | ||
import { initializeConfig } from "../lib/init/config-initializer.js"; | ||
initializeConfig(); | ||
import { ConfigGenerator } from "../lib/config-generator.js"; | ||
import { findPackageJson } from "../lib/utils/npm-utils.js"; | ||
import process from "process"; | ||
const cwd = process.cwd(); | ||
const packageJsonPath = findPackageJson(cwd); | ||
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."); | ||
} | ||
const argv = process.argv; | ||
const sharedConfigIndex = process.argv.indexOf("--config"); | ||
if (sharedConfigIndex === -1) { | ||
const generator = new ConfigGenerator({ cwd, packageJsonPath }); | ||
await generator.prompt(); | ||
generator.calc(); | ||
await generator.output(); | ||
} else { | ||
// passed "--config" | ||
const packageName = argv[sharedConfigIndex + 1]; | ||
const type = argv.includes("--eslintrc") ? "eslintrc" : "flat"; | ||
const answers = { purpose: "style", moduleType: "module", styleguide: { packageName, type } }; | ||
const generator = new ConfigGenerator({ cwd, packageJsonPath, answers }); | ||
generator.calc(); | ||
await generator.output(); | ||
} |
{ | ||
"name": "@eslint/create-config", | ||
"version": "0.4.6", | ||
"version": "1.0.0", | ||
"description": "Utility to create ESLint config files.", | ||
@@ -33,44 +33,29 @@ "keywords": [ | ||
"lint": "eslint .", | ||
"test": "mocha \"tests/init/**/*.js\"", | ||
"test:cov": "c8 npm test", | ||
"generate-alpharelease": "eslint-generate-prerelease alpha", | ||
"generate-betarelease": "eslint-generate-prerelease beta", | ||
"generate-rcrelease": "eslint-generate-prerelease rc", | ||
"generate-release": "eslint-generate-release", | ||
"publish-release": "eslint-publish-release" | ||
"release:generate:latest": "eslint-generate-release", | ||
"release:generate:alpha": "eslint-generate-prerelease alpha", | ||
"release:generate:beta": "eslint-generate-prerelease beta", | ||
"release:generate:rc": "eslint-generate-prerelease rc", | ||
"release:publish": "eslint-publish-release", | ||
"test": "vitest run --coverage", | ||
"test:snapshots": "vitest run snapshots", | ||
"test:snapshots:update": "vitest -u run snapshots" | ||
}, | ||
"mocha": { | ||
"loader": "esmock", | ||
"ui": "bdd", | ||
"timeout": 10000 | ||
}, | ||
"dependencies": { | ||
"@eslint/eslintrc": "^1.0.3", | ||
"cross-spawn": "^7.0.2", | ||
"debug": "^4.0.1", | ||
"enquirer": "^2.3.5", | ||
"js-yaml": "^4.1.0", | ||
"json-stable-stringify-without-jsonify": "^1.0.1", | ||
"mri": "^1.2.0", | ||
"semver": "^7.2.1" | ||
"enquirer": "^2.3.5" | ||
}, | ||
"devDependencies": { | ||
"c8": "^7.10.0", | ||
"chai": "^4.3.4", | ||
"eslint": "^8.2.0", | ||
"eslint-config-eslint": "^7.0.0", | ||
"eslint-plugin-jsdoc": "^37.0.3", | ||
"eslint-plugin-node": "^11.1.0", | ||
"@vitest/coverage-v8": "^1.3.1", | ||
"eslint": "^8.56.0", | ||
"eslint-config-eslint": "^9.0.0", | ||
"eslint-release": "^3.2.0", | ||
"esmock": "^2.2.3", | ||
"espree": "^9.0.0", | ||
"esmock": "^2.5.8", | ||
"lint-staged": "^12.1.2", | ||
"memfs": "^3.4.0", | ||
"mocha": "^9.1.3", | ||
"shelljs": "^0.8.4", | ||
"sinon": "^12.0.1", | ||
"vitest": "^1.1.1", | ||
"yorkie": "^2.0.0" | ||
}, | ||
"engines": { | ||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0" | ||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0" | ||
}, | ||
@@ -77,0 +62,0 @@ "lint-staged": { |
@@ -7,3 +7,3 @@ # @eslint/create-config | ||
Prerequisites: [Node.js](https://nodejs.org/) (`^12.22.0`, `^14.17.0`, or `>=16.0.0`) built with SSL support. (If you are using an official Node.js distribution, SSL is always built in.) | ||
Prerequisites: [Node.js](https://nodejs.org/) (`^18.18.0`, `^20.9.0`, or `>=21.1.0`) built with SSL support. (If you are using an official Node.js distribution, SSL is always built in.) | ||
@@ -25,20 +25,10 @@ You can use npm/npx(shipped with Node.js). | ||
```bash | ||
# use `eslint-config-semistandard` shared config | ||
# npm 7+ | ||
npm init @eslint/config -- --config semistandard | ||
# or (`eslint-config` prefix is optional) | ||
npm init @eslint/config -- --config eslint-config-semistandard | ||
# ⚠️ npm 6.x no extra double-dash: | ||
npm init @eslint/config --config semistandard | ||
# use `eslint-config-standard` shared config | ||
npm init @eslint/config -- --config eslint-config-standard | ||
``` | ||
The `--config` flag also supports passing in arrays: | ||
To use an eslintrc-style (legacy) shared config: | ||
```bash | ||
npm init @eslint/config -- --config semistandard,standard | ||
# or | ||
npm init @eslint/config -- --config semistandard --config standard | ||
npm init @eslint/config -- --eslintrc --config eslint-config-standard | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2
10
0
3
26678
542
33
2
- Removed@eslint/eslintrc@^1.0.3
- Removeddebug@^4.0.1
- Removedjs-yaml@^4.1.0
- Removedmri@^1.2.0
- Removedsemver@^7.2.1
- Removed@eslint/eslintrc@1.4.1(transitive)
- Removedacorn@8.14.0(transitive)
- Removedacorn-jsx@5.3.2(transitive)
- Removedajv@6.12.6(transitive)
- Removedargparse@2.0.1(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedcallsites@3.1.0(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removeddebug@4.3.7(transitive)
- Removedeslint-visitor-keys@3.4.3(transitive)
- Removedespree@9.6.1(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedglobals@13.24.0(transitive)
- Removedignore@5.3.2(transitive)
- Removedimport-fresh@3.3.0(transitive)
- Removedjs-yaml@4.1.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stable-stringify-without-jsonify@1.0.1(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedmri@1.2.0(transitive)
- Removedms@2.1.3(transitive)
- Removedparent-module@1.0.1(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedresolve-from@4.0.0(transitive)
- Removedsemver@7.6.3(transitive)
- Removedstrip-json-comments@3.1.1(transitive)
- Removedtype-fest@0.20.2(transitive)
- Removeduri-js@4.4.1(transitive)