From 800feb5ef9e91776626a1b54f0fd75876c0bbf07 Mon Sep 17 00:00:00 2001 From: Percy Ma Date: Tue, 1 Nov 2022 19:20:24 +0800 Subject: [PATCH 1/4] docs: init config about specifying shared configs --- docs/src/user-guide/getting-started.md | 37 +++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/docs/src/user-guide/getting-started.md b/docs/src/user-guide/getting-started.md index 675e94f10d0..6d3bdf89ba0 100644 --- a/docs/src/user-guide/getting-started.md +++ b/docs/src/user-guide/getting-started.md @@ -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 ``` -**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: + +```shell +# use `eslint-config-semistandard` shared config +# npm 6.x, yarn or pnpm +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: @@ -35,6 +66,10 @@ npx eslint yourfile.js # or yarn run eslint yourfile.js + +# or + +pnpm eslint yourfile.js ``` 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. From 6bf3a83abd8e973fc6ea310c4e726f5e53bca4a4 Mon Sep 17 00:00:00 2001 From: Percy Ma Date: Thu, 3 Nov 2022 12:45:57 +0800 Subject: [PATCH 2/4] remove yarn command --- docs/src/user-guide/getting-started.md | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/docs/src/user-guide/getting-started.md b/docs/src/user-guide/getting-started.md index 6d3bdf89ba0..1bddc5b097d 100644 --- a/docs/src/user-guide/getting-started.md +++ b/docs/src/user-guide/getting-started.md @@ -23,18 +23,9 @@ You can install and configure ESLint using this command: ```shell npm init @eslint/config - - -# or - -yarn init @eslint/config - -# or - -pnpm create @eslint/config ``` -If you want to use the specified shared configs: +If you want to use a specific shareable config that is hosted on npm, you can use the `--config` option and specify the package name: ```shell # use `eslint-config-semistandard` shared config @@ -56,7 +47,7 @@ npm init @eslint/config -- --config semistandard,standard 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. +**Note:** `npm init @eslint/config` assumes you have a `package.json` file already. If you don't, make sure to run `npm init` beforehand. After that, you can run ESLint on any file or directory like this: @@ -66,10 +57,6 @@ npx eslint yourfile.js # or yarn run eslint yourfile.js - -# or - -pnpm eslint yourfile.js ``` 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. From 7338144eef65ba6bf3847f69732ddd260ae86d29 Mon Sep 17 00:00:00 2001 From: Percy Ma Date: Sun, 6 Nov 2022 22:32:05 +0800 Subject: [PATCH 3/4] Update docs/src/user-guide/getting-started.md Co-authored-by: Nitin Kumar --- docs/src/user-guide/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/user-guide/getting-started.md b/docs/src/user-guide/getting-started.md index 1bddc5b097d..8951962bb9e 100644 --- a/docs/src/user-guide/getting-started.md +++ b/docs/src/user-guide/getting-started.md @@ -29,7 +29,7 @@ If you want to use a specific shareable config that is hosted on npm, you can us ```shell # use `eslint-config-semistandard` shared config -# npm 6.x, yarn or pnpm +# npm 6.x npm init @eslint/config --config semistandard # ⚠️ npm 7+, extra double-dash is needed: From 009eaaa7a3021b45bd926ea2e48fe40354665c3f Mon Sep 17 00:00:00 2001 From: Percy Ma Date: Tue, 8 Nov 2022 22:45:27 +0800 Subject: [PATCH 4/4] Update docs/src/user-guide/getting-started.md Co-authored-by: Milos Djermanovic --- docs/src/user-guide/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/user-guide/getting-started.md b/docs/src/user-guide/getting-started.md index 8951962bb9e..7c1b048181f 100644 --- a/docs/src/user-guide/getting-started.md +++ b/docs/src/user-guide/getting-started.md @@ -47,7 +47,7 @@ npm init @eslint/config -- --config semistandard,standard 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` beforehand. +**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. After that, you can run ESLint on any file or directory like this: