Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: init config about specifying shared configs #16483

Merged
merged 4 commits into from Nov 9, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 36 additions & 1 deletion docs/src/user-guide/getting-started.md
Expand Up @@ -23,9 +23,40 @@ You can install and configure ESLint using this command:

```shell
npm init @eslint/config


# or

yarn init @eslint/config

# or

pnpm create @eslint/config
kecrily marked this conversation as resolved.
Show resolved Hide resolved
```

**Note:** `npm init @eslint/config` assumes you have a `package.json` file already. If you don't, make sure to run `npm init` or `yarn init` beforehand.
If you want to use the specified shared configs:
kecrily marked this conversation as resolved.
Show resolved Hide resolved

```shell
# use `eslint-config-semistandard` shared config
# npm 6.x, yarn or pnpm
kecrily marked this conversation as resolved.
Show resolved Hide resolved
npm init @eslint/config --config semistandard

# ⚠️ npm 7+, extra double-dash is needed:
npm init @eslint/config -- --config semistandard

# or (`eslint-config` prefix is optional)
npm init @eslint/config -- --config eslint-config-semistandard
```

The `--config` flag also supports passing in arrays:

```shell
npm init @eslint/config -- --config semistandard,standard
# or
npm init @eslint/config -- --config semistandard --config standard
```

**Note:** `npm init @eslint/config` assumes you have a `package.json` file already. If you don't, make sure to run `npm init`, `yarn init` or `pnpm init` beforehand.

After that, you can run ESLint on any file or directory like this:

Expand All @@ -35,6 +66,10 @@ npx eslint yourfile.js
# or

yarn run eslint yourfile.js

# or

pnpm eslint yourfile.js
kecrily marked this conversation as resolved.
Show resolved Hide resolved
```

It is also possible to install ESLint globally rather than locally (using `npm install eslint --global`). However, this is not recommended, and any plugins or shareable configs that you use must be installed locally in either case.
Expand Down