Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions docs/configs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,34 @@ export default [
}
```

## no-explicit-resource-management

disallow proposal ES2026 [Explicit Resource Management](https://github.com/tc39/proposal-explicit-resource-management)\
⚠️ This config will be changed in the minor versions of this plugin.

This configs includes rules for [es-x/no-asyncdisposablestack](../rules/no-asyncdisposablestack.md), [es-x/no-disposablestack](../rules/no-disposablestack.md), [es-x/no-suppressederror](../rules/no-suppressederror.md), and [es-x/no-using-declarations](../rules/no-using-declarations.md).

### [Config (Flat Config)]

eslint.config.js:

```js
import pluginESx from "eslint-plugin-es-x"
export default [
pluginESx.configs['flat/no-explicit-resource-management']
]
```

### [Legacy Config]

.eslintrc.*:

```json
{
"extends": ["plugin:es-x/no-explicit-resource-management"],
}
```

## no-float16array

disallow proposal ES2025 [Float16Array](https://github.com/tc39/proposal-float16array)\
Expand Down
8 changes: 8 additions & 0 deletions docs/rules/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ There is a config that enables the rules in this category: [`no-new-in-esnext`]
| Rule ID | Description | |
|:--------|:------------|:--:|
| [es-x/no-array-fromasync](./no-array-fromasync.md) | disallow the `Array.fromAsync` method. | |
| [es-x/no-asyncdisposablestack](./no-asyncdisposablestack.md) | disallow the `AsyncDisposableStack` class. | |
| [es-x/no-disposablestack](./no-disposablestack.md) | disallow the `DisposableStack` class. | |
| [es-x/no-error-iserror](./no-error-iserror.md) | disallow the `Error.isError` method. | |
| [es-x/no-suppressederror](./no-suppressederror.md) | disallow the `SuppressedError` class. | |
| [es-x/no-using-declarations](./no-using-declarations.md) | disallow `using` and `await using` declarations. | |

## ES2025

Expand Down Expand Up @@ -409,6 +413,8 @@ Rules in this category are not included in any preset.
| [es-x/no-nonstandard-array-prototype-properties](./no-nonstandard-array-prototype-properties.md) | disallow non-standard properties on Array instance. | |
| [es-x/no-nonstandard-arraybuffer-properties](./no-nonstandard-arraybuffer-properties.md) | disallow non-standard static properties on `ArrayBuffer` class. | |
| [es-x/no-nonstandard-arraybuffer-prototype-properties](./no-nonstandard-arraybuffer-prototype-properties.md) | disallow non-standard properties on ArrayBuffer instance. | |
| [es-x/no-nonstandard-asyncdisposablestack-properties](./no-nonstandard-asyncdisposablestack-properties.md) | disallow non-standard static properties on `AsyncDisposableStack` class. | |
| [es-x/no-nonstandard-asyncdisposablestack-prototype-properties](./no-nonstandard-asyncdisposablestack-prototype-properties.md) | disallow non-standard properties on AsyncDisposableStack instance. | |
| [es-x/no-nonstandard-atomics-properties](./no-nonstandard-atomics-properties.md) | disallow non-standard static properties on `Atomics`. | |
| [es-x/no-nonstandard-bigint-properties](./no-nonstandard-bigint-properties.md) | disallow non-standard static properties on `BigInt` class. | |
| [es-x/no-nonstandard-bigint-prototype-properties](./no-nonstandard-bigint-prototype-properties.md) | disallow non-standard properties on BigInt instance. | |
Expand All @@ -418,6 +424,8 @@ Rules in this category are not included in any preset.
| [es-x/no-nonstandard-dataview-prototype-properties](./no-nonstandard-dataview-prototype-properties.md) | disallow non-standard properties on DataView instance. | |
| [es-x/no-nonstandard-date-properties](./no-nonstandard-date-properties.md) | disallow non-standard static properties on `Date` class. | |
| [es-x/no-nonstandard-date-prototype-properties](./no-nonstandard-date-prototype-properties.md) | disallow non-standard properties on Date instance. | |
| [es-x/no-nonstandard-disposablestack-properties](./no-nonstandard-disposablestack-properties.md) | disallow non-standard static properties on `DisposableStack` class. | |
| [es-x/no-nonstandard-disposablestack-prototype-properties](./no-nonstandard-disposablestack-prototype-properties.md) | disallow non-standard properties on DisposableStack instance. | |
| [es-x/no-nonstandard-error-properties](./no-nonstandard-error-properties.md) | disallow non-standard static properties on `Error` class. | |
| [es-x/no-nonstandard-finalizationregistry-properties](./no-nonstandard-finalizationregistry-properties.md) | disallow non-standard static properties on `FinalizationRegistry` class. | |
| [es-x/no-nonstandard-finalizationregistry-prototype-properties](./no-nonstandard-finalizationregistry-prototype-properties.md) | disallow non-standard properties on FinalizationRegistry instance. | |
Expand Down
33 changes: 33 additions & 0 deletions docs/rules/no-asyncdisposablestack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: "es-x/no-asyncdisposablestack"
description: "disallow the `AsyncDisposableStack` class"
---

# es-x/no-asyncdisposablestack
> disallow the `AsyncDisposableStack` class

- ❗ <badge text="This rule has not been released yet." vertical="middle" type="error"> ***This rule has not been released yet.*** </badge>
- ✅ The following configurations enable this rule: [no-explicit-resource-management] and [no-new-in-esnext]

This rule reports ES2026 [`AsyncDisposableStack` class](https://github.com/tc39/proposal-explicit-resource-management) as errors.

## 💡 Examples

⛔ Examples of **incorrect** code for this rule:

<eslint-playground type="bad">

```js
/*eslint es-x/no-asyncdisposablestack: error */
let asyncdisposablestack = new AsyncDisposableStack()
```

</eslint-playground>

## 📚 References

- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-asyncdisposablestack.js)
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-asyncdisposablestack.js)

[no-explicit-resource-management]: ../configs/index.md#no-explicit-resource-management
[no-new-in-esnext]: ../configs/index.md#no-new-in-esnext
33 changes: 33 additions & 0 deletions docs/rules/no-disposablestack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: "es-x/no-disposablestack"
description: "disallow the `DisposableStack` class"
---

# es-x/no-disposablestack
> disallow the `DisposableStack` class

- ❗ <badge text="This rule has not been released yet." vertical="middle" type="error"> ***This rule has not been released yet.*** </badge>
- ✅ The following configurations enable this rule: [no-explicit-resource-management] and [no-new-in-esnext]

This rule reports ES2026 [`DisposableStack` class](https://github.com/tc39/proposal-explicit-resource-management) as errors.

## 💡 Examples

⛔ Examples of **incorrect** code for this rule:

<eslint-playground type="bad">

```js
/*eslint es-x/no-disposablestack: error */
let disposablestack = new DisposableStack()
```

</eslint-playground>

## 📚 References

- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-disposablestack.js)
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-disposablestack.js)

[no-explicit-resource-management]: ../configs/index.md#no-explicit-resource-management
[no-new-in-esnext]: ../configs/index.md#no-new-in-esnext
56 changes: 56 additions & 0 deletions docs/rules/no-nonstandard-asyncdisposablestack-properties.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
title: "es-x/no-nonstandard-asyncdisposablestack-properties"
description: "disallow non-standard static properties on `AsyncDisposableStack` class"
---

# es-x/no-nonstandard-asyncdisposablestack-properties
> disallow non-standard static properties on `AsyncDisposableStack` class

- ❗ <badge text="This rule has not been released yet." vertical="middle" type="error"> ***This rule has not been released yet.*** </badge>

This rule reports non-standard static properties on `AsyncDisposableStack` class as errors.

## 💡 Examples

⛔ Examples of **incorrect** code for this rule:

<eslint-playground type="bad">

```js
/*eslint es-x/no-nonstandard-asyncdisposablestack-properties: error */
AsyncDisposableStack.unknown();
```

</eslint-playground>

## 🔧 Options

This rule has an option.

```jsonc
{
"rules": {
"es-x/no-nonstandard-asyncdisposablestack-properties": [
"error",
{
"allow": [],
"allowTestedProperty": false
}
]
}
}
```

### allow: string[]

An array of non-standard property names to allow.

### allowTestedProperty: boolean

Configure the allowTestedProperty mode for only this rule.
This is prior to the `settings['es-x'].allowTestedProperty` setting.

## 📚 References

- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-nonstandard-asyncdisposablestack-properties.js)
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-nonstandard-asyncdisposablestack-properties.js)
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
title: "es-x/no-nonstandard-asyncdisposablestack-prototype-properties"
description: "disallow non-standard properties on AsyncDisposableStack instance"
---

# es-x/no-nonstandard-asyncdisposablestack-prototype-properties
> disallow non-standard properties on AsyncDisposableStack instance

- ❗ <badge text="This rule has not been released yet." vertical="middle" type="error"> ***This rule has not been released yet.*** </badge>

This rule reports non-standard properties on AsyncDisposableStack instance as errors.

## 💡 Examples

⛔ Examples of **incorrect** code for this rule:

<eslint-playground type="bad">

```js
/*eslint es-x/no-nonstandard-asyncdisposablestack-prototype-properties: error */
const foo = new AsyncDisposableStack();
foo.unknown();
```

</eslint-playground>

## 🔧 Options

This rule has an option.

```jsonc
{
"rules": {
"es-x/no-nonstandard-asyncdisposablestack-prototype-properties": [
"error",
{
"allow": [],
"allowTestedProperty": false
}
]
}
}
```

### allow: string[]

An array of non-standard property names to allow.

### allowTestedProperty: boolean

Configure the allowTestedProperty mode for only this rule.
This is prior to the `settings['es-x'].allowTestedProperty` setting.

## 📚 References

- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-nonstandard-asyncdisposablestack-prototype-properties.js)
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-nonstandard-asyncdisposablestack-prototype-properties.js)
56 changes: 56 additions & 0 deletions docs/rules/no-nonstandard-disposablestack-properties.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
title: "es-x/no-nonstandard-disposablestack-properties"
description: "disallow non-standard static properties on `DisposableStack` class"
---

# es-x/no-nonstandard-disposablestack-properties
> disallow non-standard static properties on `DisposableStack` class

- ❗ <badge text="This rule has not been released yet." vertical="middle" type="error"> ***This rule has not been released yet.*** </badge>

This rule reports non-standard static properties on `DisposableStack` class as errors.

## 💡 Examples

⛔ Examples of **incorrect** code for this rule:

<eslint-playground type="bad">

```js
/*eslint es-x/no-nonstandard-disposablestack-properties: error */
DisposableStack.unknown();
```

</eslint-playground>

## 🔧 Options

This rule has an option.

```jsonc
{
"rules": {
"es-x/no-nonstandard-disposablestack-properties": [
"error",
{
"allow": [],
"allowTestedProperty": false
}
]
}
}
```

### allow: string[]

An array of non-standard property names to allow.

### allowTestedProperty: boolean

Configure the allowTestedProperty mode for only this rule.
This is prior to the `settings['es-x'].allowTestedProperty` setting.

## 📚 References

- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-nonstandard-disposablestack-properties.js)
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-nonstandard-disposablestack-properties.js)
57 changes: 57 additions & 0 deletions docs/rules/no-nonstandard-disposablestack-prototype-properties.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
title: "es-x/no-nonstandard-disposablestack-prototype-properties"
description: "disallow non-standard properties on DisposableStack instance"
---

# es-x/no-nonstandard-disposablestack-prototype-properties
> disallow non-standard properties on DisposableStack instance

- ❗ <badge text="This rule has not been released yet." vertical="middle" type="error"> ***This rule has not been released yet.*** </badge>

This rule reports non-standard properties on DisposableStack instance as errors.

## 💡 Examples

⛔ Examples of **incorrect** code for this rule:

<eslint-playground type="bad">

```js
/*eslint es-x/no-nonstandard-disposablestack-prototype-properties: error */
const foo = new DisposableStack();
foo.unknown();
```

</eslint-playground>

## 🔧 Options

This rule has an option.

```jsonc
{
"rules": {
"es-x/no-nonstandard-disposablestack-prototype-properties": [
"error",
{
"allow": [],
"allowTestedProperty": false
}
]
}
}
```

### allow: string[]

An array of non-standard property names to allow.

### allowTestedProperty: boolean

Configure the allowTestedProperty mode for only this rule.
This is prior to the `settings['es-x'].allowTestedProperty` setting.

## 📚 References

- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-nonstandard-disposablestack-prototype-properties.js)
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-nonstandard-disposablestack-prototype-properties.js)
33 changes: 33 additions & 0 deletions docs/rules/no-suppressederror.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: "es-x/no-suppressederror"
description: "disallow the `SuppressedError` class"
---

# es-x/no-suppressederror
> disallow the `SuppressedError` class

- ❗ <badge text="This rule has not been released yet." vertical="middle" type="error"> ***This rule has not been released yet.*** </badge>
- ✅ The following configurations enable this rule: [no-explicit-resource-management] and [no-new-in-esnext]

This rule reports ES2026 [`SuppressedError` class](https://github.com/tc39/proposal-explicit-resource-management) as errors.

## 💡 Examples

⛔ Examples of **incorrect** code for this rule:

<eslint-playground type="bad">

```js
/*eslint es-x/no-suppressederror: error */
let suppressederror = new SuppressedError()
```

</eslint-playground>

## 📚 References

- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-suppressederror.js)
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-suppressederror.js)

[no-explicit-resource-management]: ../configs/index.md#no-explicit-resource-management
[no-new-in-esnext]: ../configs/index.md#no-new-in-esnext
Loading