Skip to content

Commit 66e8b16

Browse files
authored
Add rules to check for global objects that have no static properties (#232)
1 parent 9fb19d6 commit 66e8b16

23 files changed

+898
-0
lines changed

docs/rules/index.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,11 @@ Rules in this category are not included in any preset.
393393
| [es-x/no-nonstandard-bigint-prototype-properties](./no-nonstandard-bigint-prototype-properties.md) | disallow non-standard properties on BigInt instance. | |
394394
| [es-x/no-nonstandard-boolean-properties](./no-nonstandard-boolean-properties.md) | disallow non-standard static properties on `Boolean` class. | |
395395
| [es-x/no-nonstandard-boolean-prototype-properties](./no-nonstandard-boolean-prototype-properties.md) | disallow non-standard properties on Boolean instance. | |
396+
| [es-x/no-nonstandard-dataview-properties](./no-nonstandard-dataview-properties.md) | disallow non-standard static properties on `DataView` class. | |
396397
| [es-x/no-nonstandard-dataview-prototype-properties](./no-nonstandard-dataview-prototype-properties.md) | disallow non-standard properties on DataView instance. | |
397398
| [es-x/no-nonstandard-date-properties](./no-nonstandard-date-properties.md) | disallow non-standard static properties on `Date` class. | |
398399
| [es-x/no-nonstandard-date-prototype-properties](./no-nonstandard-date-prototype-properties.md) | disallow non-standard properties on Date instance. | |
400+
| [es-x/no-nonstandard-finalizationregistry-properties](./no-nonstandard-finalizationregistry-properties.md) | disallow non-standard static properties on `FinalizationRegistry` class. | |
399401
| [es-x/no-nonstandard-finalizationregistry-prototype-properties](./no-nonstandard-finalizationregistry-prototype-properties.md) | disallow non-standard properties on FinalizationRegistry instance. | |
400402
| [es-x/no-nonstandard-function-properties](./no-nonstandard-function-properties.md) | disallow non-standard static properties on `Function` class. | |
401403
| [es-x/no-nonstandard-intl-collator-properties](./no-nonstandard-intl-collator-properties.md) | disallow non-standard static properties on `Intl.Collator` class. | |
@@ -432,16 +434,21 @@ Rules in this category are not included in any preset.
432434
| [es-x/no-nonstandard-reflect-properties](./no-nonstandard-reflect-properties.md) | disallow non-standard static properties on `Reflect`. | |
433435
| [es-x/no-nonstandard-regexp-properties](./no-nonstandard-regexp-properties.md) | disallow non-standard static properties on `RegExp` class. | |
434436
| [es-x/no-nonstandard-regexp-prototype-properties](./no-nonstandard-regexp-prototype-properties.md) | disallow non-standard properties on RegExp instance. | |
437+
| [es-x/no-nonstandard-set-properties](./no-nonstandard-set-properties.md) | disallow non-standard static properties on `Set` class. | |
435438
| [es-x/no-nonstandard-set-prototype-properties](./no-nonstandard-set-prototype-properties.md) | disallow non-standard properties on Set instance. | |
439+
| [es-x/no-nonstandard-sharedarraybuffer-properties](./no-nonstandard-sharedarraybuffer-properties.md) | disallow non-standard static properties on `SharedArrayBuffer` class. | |
436440
| [es-x/no-nonstandard-sharedarraybuffer-prototype-properties](./no-nonstandard-sharedarraybuffer-prototype-properties.md) | disallow non-standard properties on SharedArrayBuffer instance. | |
437441
| [es-x/no-nonstandard-string-properties](./no-nonstandard-string-properties.md) | disallow non-standard static properties on `String` class. | |
438442
| [es-x/no-nonstandard-string-prototype-properties](./no-nonstandard-string-prototype-properties.md) | disallow non-standard properties on String instance. | |
439443
| [es-x/no-nonstandard-symbol-properties](./no-nonstandard-symbol-properties.md) | disallow non-standard static properties on `Symbol` class. | |
440444
| [es-x/no-nonstandard-symbol-prototype-properties](./no-nonstandard-symbol-prototype-properties.md) | disallow non-standard properties on Symbol instance. | |
441445
| [es-x/no-nonstandard-typed-array-properties](./no-nonstandard-typed-array-properties.md) | disallow non-standard static properties on typed array class. | |
442446
| [es-x/no-nonstandard-typed-array-prototype-properties](./no-nonstandard-typed-array-prototype-properties.md) | disallow non-standard properties on typed array instance. | |
447+
| [es-x/no-nonstandard-weakmap-properties](./no-nonstandard-weakmap-properties.md) | disallow non-standard static properties on `WeakMap` class. | |
443448
| [es-x/no-nonstandard-weakmap-prototype-properties](./no-nonstandard-weakmap-prototype-properties.md) | disallow non-standard properties on WeakMap instance. | |
449+
| [es-x/no-nonstandard-weakref-properties](./no-nonstandard-weakref-properties.md) | disallow non-standard static properties on `WeakRef` class. | |
444450
| [es-x/no-nonstandard-weakref-prototype-properties](./no-nonstandard-weakref-prototype-properties.md) | disallow non-standard properties on WeakRef instance. | |
451+
| [es-x/no-nonstandard-weakset-properties](./no-nonstandard-weakset-properties.md) | disallow non-standard static properties on `WeakSet` class. | |
445452
| [es-x/no-nonstandard-weakset-prototype-properties](./no-nonstandard-weakset-prototype-properties.md) | disallow non-standard properties on WeakSet instance. | |
446453

447454
## Deprecated
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: "es-x/no-nonstandard-dataview-properties"
3+
description: "disallow non-standard static properties on `DataView` class"
4+
---
5+
6+
# es-x/no-nonstandard-dataview-properties
7+
> disallow non-standard static properties on `DataView` class
8+
9+
- ❗ <badge text="This rule has not been released yet." vertical="middle" type="error"> ***This rule has not been released yet.*** </badge>
10+
11+
This rule reports non-standard static properties on `DataView` class as errors.
12+
13+
## 💡 Examples
14+
15+
⛔ Examples of **incorrect** code for this rule:
16+
17+
<eslint-playground type="bad">
18+
19+
```js
20+
/*eslint es-x/no-nonstandard-dataview-properties: error */
21+
DataView.unknown();
22+
```
23+
24+
</eslint-playground>
25+
26+
## 🔧 Options
27+
28+
This rule has an option.
29+
30+
```jsonc
31+
{
32+
"rules": {
33+
"es-x/no-nonstandard-dataview-properties": [
34+
"error",
35+
{
36+
"allow": []
37+
}
38+
]
39+
}
40+
}
41+
```
42+
43+
### allow: string[]
44+
45+
An array of non-standard property names to allow.
46+
47+
## 📚 References
48+
49+
- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-nonstandard-dataview-properties.js)
50+
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-nonstandard-dataview-properties.js)
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: "es-x/no-nonstandard-finalizationregistry-properties"
3+
description: "disallow non-standard static properties on `FinalizationRegistry` class"
4+
---
5+
6+
# es-x/no-nonstandard-finalizationregistry-properties
7+
> disallow non-standard static properties on `FinalizationRegistry` class
8+
9+
- ❗ <badge text="This rule has not been released yet." vertical="middle" type="error"> ***This rule has not been released yet.*** </badge>
10+
11+
This rule reports non-standard static properties on `FinalizationRegistry` class as errors.
12+
13+
## 💡 Examples
14+
15+
⛔ Examples of **incorrect** code for this rule:
16+
17+
<eslint-playground type="bad">
18+
19+
```js
20+
/*eslint es-x/no-nonstandard-finalizationregistry-properties: error */
21+
FinalizationRegistry.unknown();
22+
```
23+
24+
</eslint-playground>
25+
26+
## 🔧 Options
27+
28+
This rule has an option.
29+
30+
```jsonc
31+
{
32+
"rules": {
33+
"es-x/no-nonstandard-finalizationregistry-properties": [
34+
"error",
35+
{
36+
"allow": []
37+
}
38+
]
39+
}
40+
}
41+
```
42+
43+
### allow: string[]
44+
45+
An array of non-standard property names to allow.
46+
47+
## 📚 References
48+
49+
- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-nonstandard-finalizationregistry-properties.js)
50+
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-nonstandard-finalizationregistry-properties.js)
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: "es-x/no-nonstandard-set-properties"
3+
description: "disallow non-standard static properties on `Set` class"
4+
---
5+
6+
# es-x/no-nonstandard-set-properties
7+
> disallow non-standard static properties on `Set` class
8+
9+
- ❗ <badge text="This rule has not been released yet." vertical="middle" type="error"> ***This rule has not been released yet.*** </badge>
10+
11+
This rule reports non-standard static properties on `Set` class as errors.
12+
13+
## 💡 Examples
14+
15+
⛔ Examples of **incorrect** code for this rule:
16+
17+
<eslint-playground type="bad">
18+
19+
```js
20+
/*eslint es-x/no-nonstandard-set-properties: error */
21+
Set.unknown();
22+
```
23+
24+
</eslint-playground>
25+
26+
## 🔧 Options
27+
28+
This rule has an option.
29+
30+
```jsonc
31+
{
32+
"rules": {
33+
"es-x/no-nonstandard-set-properties": [
34+
"error",
35+
{
36+
"allow": []
37+
}
38+
]
39+
}
40+
}
41+
```
42+
43+
### allow: string[]
44+
45+
An array of non-standard property names to allow.
46+
47+
## 📚 References
48+
49+
- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-nonstandard-set-properties.js)
50+
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-nonstandard-set-properties.js)
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: "es-x/no-nonstandard-sharedarraybuffer-properties"
3+
description: "disallow non-standard static properties on `SharedArrayBuffer` class"
4+
---
5+
6+
# es-x/no-nonstandard-sharedarraybuffer-properties
7+
> disallow non-standard static properties on `SharedArrayBuffer` class
8+
9+
- ❗ <badge text="This rule has not been released yet." vertical="middle" type="error"> ***This rule has not been released yet.*** </badge>
10+
11+
This rule reports non-standard static properties on `SharedArrayBuffer` class as errors.
12+
13+
## 💡 Examples
14+
15+
⛔ Examples of **incorrect** code for this rule:
16+
17+
<eslint-playground type="bad">
18+
19+
```js
20+
/*eslint es-x/no-nonstandard-sharedarraybuffer-properties: error */
21+
SharedArrayBuffer.unknown();
22+
```
23+
24+
</eslint-playground>
25+
26+
## 🔧 Options
27+
28+
This rule has an option.
29+
30+
```jsonc
31+
{
32+
"rules": {
33+
"es-x/no-nonstandard-sharedarraybuffer-properties": [
34+
"error",
35+
{
36+
"allow": []
37+
}
38+
]
39+
}
40+
}
41+
```
42+
43+
### allow: string[]
44+
45+
An array of non-standard property names to allow.
46+
47+
## 📚 References
48+
49+
- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-nonstandard-sharedarraybuffer-properties.js)
50+
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-nonstandard-sharedarraybuffer-properties.js)
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: "es-x/no-nonstandard-weakmap-properties"
3+
description: "disallow non-standard static properties on `WeakMap` class"
4+
---
5+
6+
# es-x/no-nonstandard-weakmap-properties
7+
> disallow non-standard static properties on `WeakMap` class
8+
9+
- ❗ <badge text="This rule has not been released yet." vertical="middle" type="error"> ***This rule has not been released yet.*** </badge>
10+
11+
This rule reports non-standard static properties on `WeakMap` class as errors.
12+
13+
## 💡 Examples
14+
15+
⛔ Examples of **incorrect** code for this rule:
16+
17+
<eslint-playground type="bad">
18+
19+
```js
20+
/*eslint es-x/no-nonstandard-weakmap-properties: error */
21+
WeakMap.unknown();
22+
```
23+
24+
</eslint-playground>
25+
26+
## 🔧 Options
27+
28+
This rule has an option.
29+
30+
```jsonc
31+
{
32+
"rules": {
33+
"es-x/no-nonstandard-weakmap-properties": [
34+
"error",
35+
{
36+
"allow": []
37+
}
38+
]
39+
}
40+
}
41+
```
42+
43+
### allow: string[]
44+
45+
An array of non-standard property names to allow.
46+
47+
## 📚 References
48+
49+
- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-nonstandard-weakmap-properties.js)
50+
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-nonstandard-weakmap-properties.js)
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: "es-x/no-nonstandard-weakref-properties"
3+
description: "disallow non-standard static properties on `WeakRef` class"
4+
---
5+
6+
# es-x/no-nonstandard-weakref-properties
7+
> disallow non-standard static properties on `WeakRef` class
8+
9+
- ❗ <badge text="This rule has not been released yet." vertical="middle" type="error"> ***This rule has not been released yet.*** </badge>
10+
11+
This rule reports non-standard static properties on `WeakRef` class as errors.
12+
13+
## 💡 Examples
14+
15+
⛔ Examples of **incorrect** code for this rule:
16+
17+
<eslint-playground type="bad">
18+
19+
```js
20+
/*eslint es-x/no-nonstandard-weakref-properties: error */
21+
WeakRef.unknown();
22+
```
23+
24+
</eslint-playground>
25+
26+
## 🔧 Options
27+
28+
This rule has an option.
29+
30+
```jsonc
31+
{
32+
"rules": {
33+
"es-x/no-nonstandard-weakref-properties": [
34+
"error",
35+
{
36+
"allow": []
37+
}
38+
]
39+
}
40+
}
41+
```
42+
43+
### allow: string[]
44+
45+
An array of non-standard property names to allow.
46+
47+
## 📚 References
48+
49+
- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-nonstandard-weakref-properties.js)
50+
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-nonstandard-weakref-properties.js)
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: "es-x/no-nonstandard-weakset-properties"
3+
description: "disallow non-standard static properties on `WeakSet` class"
4+
---
5+
6+
# es-x/no-nonstandard-weakset-properties
7+
> disallow non-standard static properties on `WeakSet` class
8+
9+
- ❗ <badge text="This rule has not been released yet." vertical="middle" type="error"> ***This rule has not been released yet.*** </badge>
10+
11+
This rule reports non-standard static properties on `WeakSet` class as errors.
12+
13+
## 💡 Examples
14+
15+
⛔ Examples of **incorrect** code for this rule:
16+
17+
<eslint-playground type="bad">
18+
19+
```js
20+
/*eslint es-x/no-nonstandard-weakset-properties: error */
21+
WeakSet.unknown();
22+
```
23+
24+
</eslint-playground>
25+
26+
## 🔧 Options
27+
28+
This rule has an option.
29+
30+
```jsonc
31+
{
32+
"rules": {
33+
"es-x/no-nonstandard-weakset-properties": [
34+
"error",
35+
{
36+
"allow": []
37+
}
38+
]
39+
}
40+
}
41+
```
42+
43+
### allow: string[]
44+
45+
An array of non-standard property names to allow.
46+
47+
## 📚 References
48+
49+
- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-nonstandard-weakset-properties.js)
50+
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-nonstandard-weakset-properties.js)

0 commit comments

Comments
 (0)