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/no-obj-calls.md
+14-4Lines changed: 14 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,13 +17,17 @@ The [ECMAScript 2015 specification](https://www.ecma-international.org/ecma-262/
17
17
18
18
> The Reflect object also does not have a `[[Call]]` internal method; it is not possible to invoke the Reflect object as a function.
19
19
20
-
And the[ECMAScript 2017 specification](https://www.ecma-international.org/ecma-262/8.0/index.html#sec-atomics-object) makes it clear that `Atomics` cannot be invoked:
20
+
The[ECMAScript 2017 specification](https://www.ecma-international.org/ecma-262/8.0/index.html#sec-atomics-object) makes it clear that `Atomics` cannot be invoked:
21
21
22
22
> The Atomics object does not have a `[[Call]]` internal method; it is not possible to invoke the Atomics object as a function.
23
23
24
+
And the [ECMAScript Internationalization API Specification](https://tc39.es/ecma402/#intl-object) makes it clear that `Intl` cannot be invoked:
25
+
26
+
> The Intl object does not have a `[[Call]]` internal method; it is not possible to invoke the Intl object as a function.
27
+
24
28
## Rule Details
25
29
26
-
This rule disallows calling the `Math`, `JSON`, `Reflect`and `Atomics` objects as functions.
30
+
This rule disallows calling the `Math`, `JSON`, `Reflect`, `Atomics`and `Intl` objects as functions.
27
31
28
32
This rule also disallows using these objects as constructors with the `new` operator.
29
33
@@ -33,7 +37,7 @@ Examples of **incorrect** code for this rule:
33
37
34
38
```js
35
39
/*eslint no-obj-calls: "error"*/
36
-
/*eslint-env es2017*/
40
+
/*eslint-env es2017, browser */
37
41
38
42
var math =Math();
39
43
@@ -50,6 +54,10 @@ var newReflect = new Reflect();
50
54
var atomics =Atomics();
51
55
52
56
var newAtomics =newAtomics();
57
+
58
+
var intl =Intl();
59
+
60
+
var newIntl =newIntl();
53
61
```
54
62
55
63
:::
@@ -60,7 +68,7 @@ Examples of **correct** code for this rule:
60
68
61
69
```js
62
70
/*eslint no-obj-calls: "error"*/
63
-
/*eslint-env es2017*/
71
+
/*eslint-env es2017, browser*/
64
72
65
73
functionarea(r) {
66
74
returnMath.PI* r * r;
@@ -71,6 +79,8 @@ var object = JSON.parse("{}");
71
79
var value =Reflect.get({ x:1, y:2 }, "x");
72
80
73
81
var first =Atomics.load(foo, 0);
82
+
83
+
var segmenterFr =newIntl.Segmenter("fr", { granularity:"word" });
0 commit comments