Skip to content

Commit 851a404

Browse files
authored
Suggest to create .eslintrc for IDE lint plugins (#2054)
* Suggest to create .eslintrc for IDE lint plugins * Update README.md * Update README.md
1 parent 3fac036 commit 851a404

File tree

1 file changed

+6
-32
lines changed

1 file changed

+6
-32
lines changed

packages/react-scripts/template/README.md

+6-32
Original file line numberDiff line numberDiff line change
@@ -207,50 +207,24 @@ To configure the syntax highlighting in your favorite text editor, head to the [
207207

208208
## Displaying Lint Output in the Editor
209209

210-
>Note: this feature is available with `[email protected]` and higher.
210+
>Note: this feature is available with `[email protected]` and higher.
211+
>It also only works with npm 3 or higher.
211212
212213
Some editors, including Sublime Text, Atom, and Visual Studio Code, provide plugins for ESLint.
213214

214215
They are not required for linting. You should see the linter output right in your terminal as well as the browser console. However, if you prefer the lint results to appear right in your editor, there are some extra steps you can do.
215216

216-
You would need to install an ESLint plugin for your editor first.
217-
218-
>**A note for Atom `linter-eslint` users**
219-
220-
>If you are using the Atom `linter-eslint` plugin, make sure that **Use global ESLint installation** option is checked:
221-
222-
><img src="http://i.imgur.com/yVNNHJM.png" width="300">
223-
224-
225-
>**For Visual Studio Code users**
226-
227-
>VS Code ESLint plugin automatically detects Create React App's configuration file. So you do not need to create `eslintrc.json` at the root directory, except when you want to add your own rules. In that case, you should include CRA's config by adding this line:
228-
229-
>```js
230-
>{
231-
> // ...
232-
> "extends": "react-app"
233-
>}
234-
>```
235-
236-
Then add this block to the `package.json` file of your project:
217+
You would need to install an ESLint plugin for your editor first. Then, add a file called `.eslintrc` to the project root:
237218

238219
```js
239220
{
240-
// ...
241-
"eslintConfig": {
242-
"extends": "react-app"
243-
}
221+
"extends": "react-app"
244222
}
245223
```
246224

247-
Finally, you will need to install some packages *globally*:
248-
249-
```sh
250-
251-
```
225+
Now your editor should report the linting warnings.
252226

253-
We recognize that this is suboptimal, but it is currently required due to the way we hide the ESLint dependency. The ESLint team is already [working on a solution to this](https://github.com/eslint/eslint/issues/3458) so this may become unnecessary in a couple of months.
227+
Note that even if you edit your `.eslintrc` file further, these changes won’t affect the terminal and in-browser lint output. This is because Create React App intentionally provides a minimal set of rules that find common mistakes. If you want to enforce a coding style for your project, consider using [Prettier](https://github.com/jlongster/prettier) instead of ESLint style rules.
254228

255229
## Debugging in the Editor
256230

0 commit comments

Comments
 (0)