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: docs/src/rules/strict.md
-20Lines changed: 0 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -271,19 +271,13 @@ This option ensures that all functions are executed in strict mode. A strict mod
271
271
272
272
Examples of **incorrect** code for this rule with the earlier default option which has been removed:
273
273
274
-
::: incorrect { "sourceType": "script" }
275
-
276
274
```js
277
275
// "strict": "error"
278
276
279
277
functionfoo() {
280
278
}
281
279
```
282
280
283
-
:::
284
-
285
-
::: incorrect { "sourceType": "script" }
286
-
287
281
```js
288
282
// "strict": "error"
289
283
@@ -294,12 +288,8 @@ function foo() {
294
288
}());
295
289
```
296
290
297
-
:::
298
-
299
291
Examples of **correct** code for this rule with the earlier default option which has been removed:
300
292
301
-
::: correct { "sourceType": "script" }
302
-
303
293
```js
304
294
// "strict": "error"
305
295
@@ -309,10 +299,6 @@ function foo() {
309
299
}
310
300
```
311
301
312
-
:::
313
-
314
-
::: correct { "sourceType": "script" }
315
-
316
302
```js
317
303
// "strict": "error"
318
304
@@ -321,10 +307,6 @@ function foo() {
321
307
}
322
308
```
323
309
324
-
:::
325
-
326
-
::: correct { "sourceType": "script" }
327
-
328
310
```js
329
311
// "strict": "error"
330
312
@@ -336,8 +318,6 @@ function foo() {
336
318
}());
337
319
```
338
320
339
-
:::
340
-
341
321
## When Not To Use It
342
322
343
323
In a codebase that has both strict and non-strict code, either turn this rule off, or [selectively disable it](../use/configure/rules#disabling-rules) where necessary. For example, functions referencing `arguments.callee` are invalid in strict mode. A [full list of strict mode differences](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode/Transitioning_to_strict_mode#Differences_from_non-strict_to_strict) is available on MDN.
"\x1B[0m \x1B[2m12:1\x1B[22m \x1B[31merror\x1B[39m Syntax error: 'import' and 'export' may appear only with 'sourceType: module'\x1B[0m\n"+
62
62
"\x1B[0m \x1B[2m20:5\x1B[22m \x1B[31merror\x1B[39m Nonstandard language tag 'ts': use one of 'javascript', 'js' or 'jsx'\x1B[0m\n"+
63
63
"\x1B[0m \x1B[2m23:7\x1B[22m \x1B[31merror\x1B[39m Syntax error: Identifier 'foo' has already been declared\x1B[0m\n"+
64
+
"\x1B[0m \x1B[2m31:1\x1B[22m \x1B[31merror\x1B[39m Example code should contain a configuration comment like /* eslint no-restricted-syntax: \"error\" */\x1B[0m\n"+
0 commit comments