You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docusaurus/docs/advanced-configuration.md
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -22,3 +22,4 @@ You can adjust various development and production settings by setting environmen
22
22
| NODE_PATH | ✅ Used | ✅ Used | Same as [`NODE_PATH` in Node.js](https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders), but only relative folders are allowed. Can be handy for emulating a monorepo setup by setting `NODE_PATH=src`. |
23
23
| INLINE_RUNTIME_CHUNK | 🚫 Ignored | ✅ Used | By default, Create React App will embed the runtime script into `index.html` during the production build. When set to `false`, the script will not be embedded and will be imported as usual. This is normally required when dealing with CSP. |
24
24
| IMAGE_INLINE_SIZE_LIMIT | 🚫 Ignored | ✅ Used | By default, images smaller than 10,000 bytes are encoded as a data URI in base64 and inlined in the CSS or JS build artifact. Set this to control the size limit in bytes. Setting it to 0 will disable the inlining of images. |
25
+
| EXTEND_ESLINT | ✅ Used | ✅ Used | When set to `true`, ESLint configs that extend `eslint-config-react-app` will be used by `eslint-loader`. Any rules that are set to `"error"` will stop the application from building. |
Copy file name to clipboardExpand all lines: docusaurus/docs/setting-up-your-editor.md
+38-10Lines changed: 38 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -18,15 +18,7 @@ To configure the syntax highlighting in your favorite text editor, head to the [
18
18
19
19
Some editors, including Sublime Text, Atom, and Visual Studio Code, provide plugins for ESLint.
20
20
21
-
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.
22
-
23
-
You would need to install an ESLint plugin for your editor first. Then, add a file called `.eslintrc.json` to the project root:
24
-
25
-
```json
26
-
{
27
-
"extends": "react-app"
28
-
}
29
-
```
21
+
They are not required for linting. You should see the linter output right in your terminal as well as the browser console. If you prefer the lint results to appear right in your editor, please make sure you install an ESLint plugin/extension.
30
22
31
23
If you're using TypeScript and Visual Studio Code, the [ESLint Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint#overview) currently [doesn't have TypeScript support enabled by default](https://github.com/Microsoft/vscode-eslint/issues/609). To enable TypeScript support in the ESLint extension, add the following to your project's Visual Studio Code settings file, located at `.vscode/settings.json` (you can create this file if it doesn't already exist):
32
24
@@ -43,10 +35,46 @@ If you're using TypeScript and Visual Studio Code, the [ESLint Visual Studio Cod
43
35
44
36
Now your editor should report the linting warnings.
45
37
46
-
Note that even if you edit your `.eslintrc.json` file further, these changes will **only affect the editor integration**. They 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.
38
+
Note that even if you customise your ESLint config, these changes will **only affect the editor integration**. They 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.
47
39
48
40
If you want to enforce a coding style for your project, consider using [Prettier](https://github.com/jlongster/prettier) instead of ESLint style rules.
49
41
42
+
### Experimental: Extending the ESLint config
43
+
44
+
We recognise that in some cases, further customisation is required. It is now possible to extend the base ESLint config by setting the `EXTEND_ESLINT` environment variable to `true`. See [advanced configuration](advanced-configuration.md) for more information on available environment variables.
45
+
46
+
Note that any rules set to `"error"` will stop the project from building.
47
+
48
+
There are a few things to remember:
49
+
50
+
1. You must extend the base config, as removing it could introduce hard-to-find issues.
51
+
1. When working with TypeScript, you'll need to provide an `overrides` object for rules that should _only_ target TypeScript files.
52
+
53
+
In the below example:
54
+
55
+
- the base config has been extended by a shared ESLint config,
56
+
- a new rule has been set that applies to all JavaScript and TypeScript files, and
57
+
- a new rule has been set that only targets TypeScript files.
58
+
59
+
```json
60
+
{
61
+
"eslintConfig": {
62
+
"extends": ["react-app", "shared-config"],
63
+
"rules": {
64
+
"additional-rule": "warn"
65
+
},
66
+
"overrides": [
67
+
{
68
+
"files": ["**/*.ts?(x)"],
69
+
"rules": {
70
+
"additional-typescript-only-rule": "warn"
71
+
}
72
+
}
73
+
]
74
+
}
75
+
}
76
+
```
77
+
50
78
## Debugging in the Editor
51
79
52
80
**This feature is currently only supported by [Visual Studio Code](https://code.visualstudio.com) and [WebStorm](https://www.jetbrains.com/webstorm/).**
0 commit comments