Skip to content

Commit b76e316

Browse files
committed
Recommend running the CLI helper tool using npx
1 parent 4366d25 commit b76e316

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

README.md

+8-14
Original file line numberDiff line numberDiff line change
@@ -126,21 +126,15 @@ eslint-config-prettier also ships with a little CLI tool to help you check if
126126
your configuration contains any rules that are unnecessary or conflict with
127127
Prettier.
128128

129-
First, add a script for it to package.json:
129+
You can run it using `npx`:
130130

131-
<!-- prettier-ignore -->
132-
```json
133-
{
134-
"scripts": {
135-
"eslint-check": "eslint --print-config path/to/main.js | eslint-config-prettier-check"
136-
}
137-
}
131+
```
132+
npx eslint --print-config path/to/main.js | npx eslint-config-prettier-check
138133
```
139134

140-
Then run `npm run eslint-check`. (Change `path/to/main.js` to a file that
141-
exists in your project.)
135+
(Change `path/to/main.js` to a file that exists in your project.)
142136

143-
In theory you need to run `eslint --print-config file.js | eslint-config-prettier-check` for every single file in your project to be
137+
In theory you need to run `npx eslint --print-config file.js | npx eslint-config-prettier-check` for every single file in your project to be
144138
100% sure that there are no conflicting rules, because ESLint supports having
145139
different rules for different files. But usually you’ll have about the same
146140
rules for all files, so it is enough to run the command on one file (pick one
@@ -149,9 +143,9 @@ that you won’t be moving). If you use [multiple configuration files] or
149143
several times with different `--print-config` arguments, such as:
150144

151145
```
152-
eslint --print-config index.js | eslint-config-prettier-check
153-
eslint --print-config test/index.js | eslint-config-prettier-check
154-
eslint --print-config legacy/main.js | eslint-config-prettier-check
146+
npx eslint --print-config index.js | npx eslint-config-prettier-check
147+
npx eslint --print-config test/index.js | npx eslint-config-prettier-check
148+
npx eslint --print-config legacy/main.js | npx eslint-config-prettier-check
155149
```
156150

157151
Exit codes:

bin/cli.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ if (module === require.main) {
1717
"This tool checks whether an ESLint configuration contains rules that are",
1818
"unnecessary or conflict with Prettier. It’s supposed to be run like this:",
1919
"",
20-
" eslint --print-config path/to/main.js | eslint-config-prettier-check",
21-
" eslint --print-config test/index.js | eslint-config-prettier-check",
20+
" npx eslint --print-config path/to/main.js | npx eslint-config-prettier-check",
21+
" npx eslint --print-config test/index.js | npx eslint-config-prettier-check",
2222
"",
2323
"Exit codes:",
2424
"",

0 commit comments

Comments
 (0)