Skip to content

Commit

Permalink
feat!: add config for es2024 and change restrict-to-x configs (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi committed Jul 1, 2024
1 parent e5d69c4 commit e0a952c
Show file tree
Hide file tree
Showing 59 changed files with 336 additions and 34 deletions.
75 changes: 75 additions & 0 deletions docs/configs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,31 @@ export default [
}
```

## no-new-in-es2024

disallow new stuff in ES2024.

### [Config (Flat Config)]

eslint.config.js:

```js
import pluginESx from "eslint-plugin-es-x"
export default [
pluginESx.configs['flat/no-new-in-es2024']
]
```

### [Legacy Config]

.eslintrc.*:

```json
{
"extends": ["plugin:es-x/no-new-in-es2024"],
}
```

## no-new-in-es2023

disallow new stuff in ES2023.
Expand Down Expand Up @@ -453,6 +478,56 @@ export default [
}
```

## restrict-to-es2023

disallow new stuff that ES2024 doesn't include

### [Config (Flat Config)]

eslint.config.js:

```js
import pluginESx from "eslint-plugin-es-x"
export default [
pluginESx.configs['flat/restrict-to-es2023']
]
```

### [Legacy Config]

.eslintrc.*:

```json
{
"extends": ["plugin:es-x/restrict-to-es2023"],
}
```

## restrict-to-es2023-intl-api

disallow new stuff that ES2024 Intl API (ECMA-402) doesn't include

### [Config (Flat Config)]

eslint.config.js:

```js
import pluginESx from "eslint-plugin-es-x"
export default [
pluginESx.configs['flat/restrict-to-es2023-intl-api']
]
```

### [Legacy Config]

.eslintrc.*:

```json
{
"extends": ["plugin:es-x/restrict-to-es2023-intl-api"],
}
```

## restrict-to-es2022

disallow new stuff that ES2023 doesn't include
Expand Down
5 changes: 4 additions & 1 deletion docs/rules/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ There is a config that enables the rules in this category: [`no-new-in-esnext`]

## ES2024

There is a config that enables the rules in this category: [`no-new-in-esnext`]
There are multiple configs that enable all rules in this category: [`no-new-in-es2024`], [`restrict-to-es3`], [`restrict-to-es5`], [`restrict-to-es2015`], [`restrict-to-es2016`], [`restrict-to-es2017`], [`restrict-to-es2018`], [`restrict-to-es2019`], [`restrict-to-es2020`], [`restrict-to-es2021`], [`restrict-to-es2022`], and [`restrict-to-es2023`]

| Rule ID | Description | |
|:--------|:------------|:--:|
Expand Down Expand Up @@ -354,6 +354,9 @@ Rules in this category are not included in any preset.
| [es-x/no-string-prototype-trimleft-trimright](./no-string-prototype-trimleft-trimright.md) | disallow the `String.prototype.{trimLeft,trimRight}` methods. | 🔧 |

[`no-new-in-esnext`]: ../configs/index.md#no-new-in-esnext
[`no-new-in-es2024`]: ../configs/index.md#no-new-in-es2024
[`restrict-to-es2023`]: ../configs/index.md#restrict-to-es2023
[`restrict-to-es2023-intl-api`]: ../configs/index.md#restrict-to-es2023-intl-api
[`no-new-in-es2023`]: ../configs/index.md#no-new-in-es2023
[`restrict-to-es2022`]: ../configs/index.md#restrict-to-es2022
[`no-new-in-es2023-intl-api`]: ../configs/index.md#no-new-in-es2023-intl-api
Expand Down
15 changes: 13 additions & 2 deletions docs/rules/no-arraybuffer-prototype-transfer.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v7.6.0"
# es-x/no-arraybuffer-prototype-transfer
> disallow the `ArrayBuffer.prototype.transfer` method
- ✅ The following configurations enable this rule: [no-new-in-esnext]
- ✅ The following configurations enable this rule: [no-new-in-es2024], [restrict-to-es3], [restrict-to-es5], [restrict-to-es2015], [restrict-to-es2016], [restrict-to-es2017], [restrict-to-es2018], [restrict-to-es2019], [restrict-to-es2020], [restrict-to-es2021], [restrict-to-es2022], and [restrict-to-es2023]

This rule reports ES2024 [``ArrayBuffer.prototype.transfer`` methods](https://github.com/tc39/proposal-arraybuffer-transfer) as errors.

Expand Down Expand Up @@ -59,4 +59,15 @@ This rule was introduced in v7.6.0.
- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-arraybuffer-prototype-transfer.js)
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-arraybuffer-prototype-transfer.js)

[no-new-in-esnext]: ../configs/index.md#no-new-in-esnext
[no-new-in-es2024]: ../configs/index.md#no-new-in-es2024
[restrict-to-es3]: ../configs/index.md#restrict-to-es3
[restrict-to-es5]: ../configs/index.md#restrict-to-es5
[restrict-to-es2015]: ../configs/index.md#restrict-to-es2015
[restrict-to-es2016]: ../configs/index.md#restrict-to-es2016
[restrict-to-es2017]: ../configs/index.md#restrict-to-es2017
[restrict-to-es2018]: ../configs/index.md#restrict-to-es2018
[restrict-to-es2019]: ../configs/index.md#restrict-to-es2019
[restrict-to-es2020]: ../configs/index.md#restrict-to-es2020
[restrict-to-es2021]: ../configs/index.md#restrict-to-es2021
[restrict-to-es2022]: ../configs/index.md#restrict-to-es2022
[restrict-to-es2023]: ../configs/index.md#restrict-to-es2023
15 changes: 13 additions & 2 deletions docs/rules/no-atomics-waitasync.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v7.1.0"
# es-x/no-atomics-waitasync
> disallow the `Atomics.waitAsync` method
- ✅ The following configurations enable this rule: [no-new-in-esnext]
- ✅ The following configurations enable this rule: [no-new-in-es2024], [restrict-to-es3], [restrict-to-es5], [restrict-to-es2015], [restrict-to-es2016], [restrict-to-es2017], [restrict-to-es2018], [restrict-to-es2019], [restrict-to-es2020], [restrict-to-es2021], [restrict-to-es2022], and [restrict-to-es2023]

This rule reports ES2024 [`Atomics.waitAsync` method](https://github.com/tc39/proposal-atomics-wait-async) as errors.

Expand All @@ -33,4 +33,15 @@ This rule was introduced in v7.1.0.
- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-atomics-waitasync.js)
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-atomics-waitasync.js)

[no-new-in-esnext]: ../configs/index.md#no-new-in-esnext
[no-new-in-es2024]: ../configs/index.md#no-new-in-es2024
[restrict-to-es3]: ../configs/index.md#restrict-to-es3
[restrict-to-es5]: ../configs/index.md#restrict-to-es5
[restrict-to-es2015]: ../configs/index.md#restrict-to-es2015
[restrict-to-es2016]: ../configs/index.md#restrict-to-es2016
[restrict-to-es2017]: ../configs/index.md#restrict-to-es2017
[restrict-to-es2018]: ../configs/index.md#restrict-to-es2018
[restrict-to-es2019]: ../configs/index.md#restrict-to-es2019
[restrict-to-es2020]: ../configs/index.md#restrict-to-es2020
[restrict-to-es2021]: ../configs/index.md#restrict-to-es2021
[restrict-to-es2022]: ../configs/index.md#restrict-to-es2022
[restrict-to-es2023]: ../configs/index.md#restrict-to-es2023
15 changes: 13 additions & 2 deletions docs/rules/no-object-map-groupby.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v7.5.0"
# es-x/no-object-map-groupby
> disallow the `{Object,Map}.groupBy()` function (array grouping)
- ✅ The following configurations enable this rule: [no-new-in-esnext]
- ✅ The following configurations enable this rule: [no-new-in-es2024], [restrict-to-es3], [restrict-to-es5], [restrict-to-es2015], [restrict-to-es2016], [restrict-to-es2017], [restrict-to-es2018], [restrict-to-es2019], [restrict-to-es2020], [restrict-to-es2021], [restrict-to-es2022], and [restrict-to-es2023]

This rule reports ES2024 `Object.groupBy()` and `Map.groupBy()` (Array grouping) as errors.

Expand Down Expand Up @@ -39,4 +39,15 @@ This rule was introduced in v7.5.0.
- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-object-map-groupby.js)
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-object-map-groupby.js)

[no-new-in-esnext]: ../configs/index.md#no-new-in-esnext
[no-new-in-es2024]: ../configs/index.md#no-new-in-es2024
[restrict-to-es3]: ../configs/index.md#restrict-to-es3
[restrict-to-es5]: ../configs/index.md#restrict-to-es5
[restrict-to-es2015]: ../configs/index.md#restrict-to-es2015
[restrict-to-es2016]: ../configs/index.md#restrict-to-es2016
[restrict-to-es2017]: ../configs/index.md#restrict-to-es2017
[restrict-to-es2018]: ../configs/index.md#restrict-to-es2018
[restrict-to-es2019]: ../configs/index.md#restrict-to-es2019
[restrict-to-es2020]: ../configs/index.md#restrict-to-es2020
[restrict-to-es2021]: ../configs/index.md#restrict-to-es2021
[restrict-to-es2022]: ../configs/index.md#restrict-to-es2022
[restrict-to-es2023]: ../configs/index.md#restrict-to-es2023
15 changes: 13 additions & 2 deletions docs/rules/no-promise-withresolvers.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v7.5.0"
# es-x/no-promise-withresolvers
> disallow the `Promise.withResolvers()` method
- ✅ The following configurations enable this rule: [no-new-in-esnext]
- ✅ The following configurations enable this rule: [no-new-in-es2024], [restrict-to-es3], [restrict-to-es5], [restrict-to-es2015], [restrict-to-es2016], [restrict-to-es2017], [restrict-to-es2018], [restrict-to-es2019], [restrict-to-es2020], [restrict-to-es2021], [restrict-to-es2022], and [restrict-to-es2023]

This rule reports ES2024 [`Promise.withResolvers` function](https://github.com/tc39/proposal-promise-with-resolvers) as errors.

Expand All @@ -33,4 +33,15 @@ This rule was introduced in v7.5.0.
- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-promise-withresolvers.js)
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-promise-withresolvers.js)

[no-new-in-esnext]: ../configs/index.md#no-new-in-esnext
[no-new-in-es2024]: ../configs/index.md#no-new-in-es2024
[restrict-to-es3]: ../configs/index.md#restrict-to-es3
[restrict-to-es5]: ../configs/index.md#restrict-to-es5
[restrict-to-es2015]: ../configs/index.md#restrict-to-es2015
[restrict-to-es2016]: ../configs/index.md#restrict-to-es2016
[restrict-to-es2017]: ../configs/index.md#restrict-to-es2017
[restrict-to-es2018]: ../configs/index.md#restrict-to-es2018
[restrict-to-es2019]: ../configs/index.md#restrict-to-es2019
[restrict-to-es2020]: ../configs/index.md#restrict-to-es2020
[restrict-to-es2021]: ../configs/index.md#restrict-to-es2021
[restrict-to-es2022]: ../configs/index.md#restrict-to-es2022
[restrict-to-es2023]: ../configs/index.md#restrict-to-es2023
15 changes: 13 additions & 2 deletions docs/rules/no-regexp-v-flag.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v7.2.0"
# es-x/no-regexp-v-flag
> disallow RegExp `v` flag
- ✅ The following configurations enable this rule: [no-new-in-esnext]
- ✅ The following configurations enable this rule: [no-new-in-es2024], [restrict-to-es3], [restrict-to-es5], [restrict-to-es2015], [restrict-to-es2016], [restrict-to-es2017], [restrict-to-es2018], [restrict-to-es2019], [restrict-to-es2020], [restrict-to-es2021], [restrict-to-es2022], and [restrict-to-es2023]

This rule reports ES2024 [RegExp `v` flag](https://github.com/tc39/proposal-regexp-v-flag) as errors.

Expand All @@ -34,4 +34,15 @@ This rule was introduced in v7.2.0.
- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-regexp-v-flag.js)
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-regexp-v-flag.js)

[no-new-in-esnext]: ../configs/index.md#no-new-in-esnext
[no-new-in-es2024]: ../configs/index.md#no-new-in-es2024
[restrict-to-es3]: ../configs/index.md#restrict-to-es3
[restrict-to-es5]: ../configs/index.md#restrict-to-es5
[restrict-to-es2015]: ../configs/index.md#restrict-to-es2015
[restrict-to-es2016]: ../configs/index.md#restrict-to-es2016
[restrict-to-es2017]: ../configs/index.md#restrict-to-es2017
[restrict-to-es2018]: ../configs/index.md#restrict-to-es2018
[restrict-to-es2019]: ../configs/index.md#restrict-to-es2019
[restrict-to-es2020]: ../configs/index.md#restrict-to-es2020
[restrict-to-es2021]: ../configs/index.md#restrict-to-es2021
[restrict-to-es2022]: ../configs/index.md#restrict-to-es2022
[restrict-to-es2023]: ../configs/index.md#restrict-to-es2023
15 changes: 13 additions & 2 deletions docs/rules/no-resizable-and-growable-arraybuffers.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v7.3.0"
# es-x/no-resizable-and-growable-arraybuffers
> disallow resizable and growable ArrayBuffers
- ✅ The following configurations enable this rule: [no-new-in-esnext]
- ✅ The following configurations enable this rule: [no-new-in-es2024], [restrict-to-es3], [restrict-to-es5], [restrict-to-es2015], [restrict-to-es2016], [restrict-to-es2017], [restrict-to-es2018], [restrict-to-es2019], [restrict-to-es2020], [restrict-to-es2021], [restrict-to-es2022], and [restrict-to-es2023]

This rule reports ES2024 [Resizable and growable ArrayBuffers](https://github.com/tc39/proposal-resizablearraybuffer) as errors.

Expand Down Expand Up @@ -59,4 +59,15 @@ This rule was introduced in v7.3.0.
- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-resizable-and-growable-arraybuffers.js)
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-resizable-and-growable-arraybuffers.js)

[no-new-in-esnext]: ../configs/index.md#no-new-in-esnext
[no-new-in-es2024]: ../configs/index.md#no-new-in-es2024
[restrict-to-es3]: ../configs/index.md#restrict-to-es3
[restrict-to-es5]: ../configs/index.md#restrict-to-es5
[restrict-to-es2015]: ../configs/index.md#restrict-to-es2015
[restrict-to-es2016]: ../configs/index.md#restrict-to-es2016
[restrict-to-es2017]: ../configs/index.md#restrict-to-es2017
[restrict-to-es2018]: ../configs/index.md#restrict-to-es2018
[restrict-to-es2019]: ../configs/index.md#restrict-to-es2019
[restrict-to-es2020]: ../configs/index.md#restrict-to-es2020
[restrict-to-es2021]: ../configs/index.md#restrict-to-es2021
[restrict-to-es2022]: ../configs/index.md#restrict-to-es2022
[restrict-to-es2023]: ../configs/index.md#restrict-to-es2023
15 changes: 13 additions & 2 deletions docs/rules/no-string-prototype-iswellformed-towellformed.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v7.1.0"
# es-x/no-string-prototype-iswellformed-towellformed
> disallow the `String.prototype.{isWellFormed,toWellFormed}` methods
- ✅ The following configurations enable this rule: [no-new-in-esnext]
- ✅ The following configurations enable this rule: [no-new-in-es2024], [restrict-to-es3], [restrict-to-es5], [restrict-to-es2015], [restrict-to-es2016], [restrict-to-es2017], [restrict-to-es2018], [restrict-to-es2019], [restrict-to-es2020], [restrict-to-es2021], [restrict-to-es2022], and [restrict-to-es2023]

This rule reports ES2024 [`String.prototype.{isWellFormed,toWellFormed}` methods](https://github.com/tc39/proposal-is-usv-string) as errors.

Expand Down Expand Up @@ -48,4 +48,15 @@ This rule was introduced in v7.1.0.
- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-string-prototype-iswellformed-towellformed.js)
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-string-prototype-iswellformed-towellformed.js)

[no-new-in-esnext]: ../configs/index.md#no-new-in-esnext
[no-new-in-es2024]: ../configs/index.md#no-new-in-es2024
[restrict-to-es3]: ../configs/index.md#restrict-to-es3
[restrict-to-es5]: ../configs/index.md#restrict-to-es5
[restrict-to-es2015]: ../configs/index.md#restrict-to-es2015
[restrict-to-es2016]: ../configs/index.md#restrict-to-es2016
[restrict-to-es2017]: ../configs/index.md#restrict-to-es2017
[restrict-to-es2018]: ../configs/index.md#restrict-to-es2018
[restrict-to-es2019]: ../configs/index.md#restrict-to-es2019
[restrict-to-es2020]: ../configs/index.md#restrict-to-es2020
[restrict-to-es2021]: ../configs/index.md#restrict-to-es2021
[restrict-to-es2022]: ../configs/index.md#restrict-to-es2022
[restrict-to-es2023]: ../configs/index.md#restrict-to-es2023
14 changes: 14 additions & 0 deletions lib/configs/flat/no-new-in-es2024-intl-api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* DON'T EDIT THIS FILE.
* This file was generated by "scripts/update-lib-flat-configs.js" script.
*/
"use strict"

module.exports = {
plugins: {
get "es-x"() {
return require("../../index.js")
},
},
rules: {},
}
22 changes: 22 additions & 0 deletions lib/configs/flat/no-new-in-es2024.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* DON'T EDIT THIS FILE.
* This file was generated by "scripts/update-lib-flat-configs.js" script.
*/
"use strict"

module.exports = {
plugins: {
get "es-x"() {
return require("../../index.js")
},
},
rules: {
"es-x/no-arraybuffer-prototype-transfer": "error",
"es-x/no-atomics-waitasync": "error",
"es-x/no-object-map-groupby": "error",
"es-x/no-promise-withresolvers": "error",
"es-x/no-regexp-v-flag": "error",
"es-x/no-resizable-and-growable-arraybuffers": "error",
"es-x/no-string-prototype-iswellformed-towellformed": "error",
},
}
7 changes: 0 additions & 7 deletions lib/configs/flat/no-new-in-esnext.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,5 @@ module.exports = {
"es-x/no-set-prototype-issupersetof": "error",
"es-x/no-set-prototype-symmetricdifference": "error",
"es-x/no-set-prototype-union": "error",
"es-x/no-arraybuffer-prototype-transfer": "error",
"es-x/no-atomics-waitasync": "error",
"es-x/no-object-map-groupby": "error",
"es-x/no-promise-withresolvers": "error",
"es-x/no-regexp-v-flag": "error",
"es-x/no-resizable-and-growable-arraybuffers": "error",
"es-x/no-string-prototype-iswellformed-towellformed": "error",
},
}
1 change: 1 addition & 0 deletions lib/configs/flat/restrict-to-es-intl-api-1st-edition.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = {
},
},
rules: {
...require("./no-new-in-es2024-intl-api").rules,
...require("./no-new-in-es2023-intl-api").rules,
...require("./no-new-in-es2022-intl-api").rules,
...require("./no-new-in-es2021-intl-api").rules,
Expand Down
1 change: 1 addition & 0 deletions lib/configs/flat/restrict-to-es2015-intl-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = {
},
},
rules: {
...require("./no-new-in-es2024-intl-api").rules,
...require("./no-new-in-es2023-intl-api").rules,
...require("./no-new-in-es2022-intl-api").rules,
...require("./no-new-in-es2021-intl-api").rules,
Expand Down
1 change: 1 addition & 0 deletions lib/configs/flat/restrict-to-es2015.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = {
},
},
rules: {
...require("./no-new-in-es2024").rules,
...require("./no-new-in-es2023").rules,
...require("./no-new-in-es2022").rules,
...require("./no-new-in-es2021").rules,
Expand Down
1 change: 1 addition & 0 deletions lib/configs/flat/restrict-to-es2016-intl-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = {
},
},
rules: {
...require("./no-new-in-es2024-intl-api").rules,
...require("./no-new-in-es2023-intl-api").rules,
...require("./no-new-in-es2022-intl-api").rules,
...require("./no-new-in-es2021-intl-api").rules,
Expand Down
1 change: 1 addition & 0 deletions lib/configs/flat/restrict-to-es2016.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = {
},
},
rules: {
...require("./no-new-in-es2024").rules,
...require("./no-new-in-es2023").rules,
...require("./no-new-in-es2022").rules,
...require("./no-new-in-es2021").rules,
Expand Down
1 change: 1 addition & 0 deletions lib/configs/flat/restrict-to-es2017-intl-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = {
},
},
rules: {
...require("./no-new-in-es2024-intl-api").rules,
...require("./no-new-in-es2023-intl-api").rules,
...require("./no-new-in-es2022-intl-api").rules,
...require("./no-new-in-es2021-intl-api").rules,
Expand Down
1 change: 1 addition & 0 deletions lib/configs/flat/restrict-to-es2017.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = {
},
},
rules: {
...require("./no-new-in-es2024").rules,
...require("./no-new-in-es2023").rules,
...require("./no-new-in-es2022").rules,
...require("./no-new-in-es2021").rules,
Expand Down
Loading

0 comments on commit e0a952c

Please sign in to comment.