Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@eslint/create-config

Package Overview
Dependencies
Maintainers
2
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eslint/create-config - npm Package Compare versions

Comparing version 0.4.6 to 1.0.0

lib/config-generator.js

39

bin/create-config.js
#!/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();
}

47

package.json
{
"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
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc