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
@@ -67,6 +75,48 @@ You can use the following configs by adding them to `eslint.config.js`.
67
75
By default, all rules from **base** and **essential** categories report ESLint errors. Other rules - because they're not covering potential bugs in the application - report warnings. What does it mean? By default - nothing, but if you want - you can set up a threshold and break the build after a certain amount of warnings, instead of any. More information [here](https://eslint.org/docs/user-guide/command-line-interface#handling-warnings).
68
76
:::
69
77
78
+
#### Specifying Globals (`eslint.config.js`)
79
+
80
+
Specify global objects depending on how you use Vue.js. More information on how to set globals can be found [here](https://eslint.org/docs/latest/use/configure/language-options#predefined-global-variables).
81
+
82
+
If you're writing an app that will only render on the browser, use `globals.browser`.
83
+
84
+
```js
85
+
// ...
86
+
importglobalsfrom'globals'
87
+
88
+
exportdefault [
89
+
// ...
90
+
{
91
+
languageOptions: {
92
+
globals: {
93
+
...globals.browser
94
+
}
95
+
}
96
+
}
97
+
// ...
98
+
]
99
+
```
100
+
101
+
If you're writing an app that is rendered both server-side and on the browser, use `globals.shared-node-browser`.
102
+
103
+
```js
104
+
// ...
105
+
importglobalsfrom'globals'
106
+
107
+
exportdefault [
108
+
// ...
109
+
{
110
+
languageOptions: {
111
+
globals: {
112
+
...globals['shared-node-browser']
113
+
}
114
+
}
115
+
}
116
+
// ...
117
+
]
118
+
```
119
+
70
120
#### Example configuration with [typescript-eslint](https://typescript-eslint.io/) and [Prettier](https://prettier.io/)
71
121
72
122
```bash
@@ -152,6 +202,30 @@ This plugin supports the basic syntax of Vue.js 3.2, `<script setup>`, and CSS v
152
202
If you have issues with these, please also refer to the [FAQ](#does-not-work-well-with-script-setup). If you can't find a solution, search for the issue and if the issue doesn't exist, open a new issue.
153
203
:::
154
204
205
+
#### Specifying Environments (`.eslintrc`)
206
+
207
+
Specify environments depending on how you use Vue.js. More information on how to set environments can be found [here](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-environments).
208
+
209
+
If you're writing an app that will only render on the browser, use `env.browser`.
210
+
211
+
```json
212
+
{
213
+
"env": {
214
+
"browser": true
215
+
}
216
+
}
217
+
```
218
+
219
+
If you're writing an app that is rendered both server-side and on the browser, use `env.shared-node-browser`.
220
+
221
+
```json
222
+
{
223
+
"env": {
224
+
"shared-node-browser": true
225
+
}
226
+
}
227
+
```
228
+
155
229
### Running ESLint from the command line
156
230
157
231
If you want to run `eslint` from the command line, ESLint will automatically check for the `.vue` extension if you use the config provided by the plugin.
0 commit comments