Skip to content
Open
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
36 changes: 21 additions & 15 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,29 @@ For example, to enable only Rest/Spread Properties in ES2018, as similar to lega

This plugin provides the following configs.

<!-- PRESETS_TABLE_START -->

| Config ID | Description |
|:----------|:------------|
| `plugin:es/restrict-to-es2019` | disallow new stuff that ES2019 doesn't include.
| `plugin:es/restrict-to-es2018` | disallow new stuff that ES2018 doesn't include.
| `plugin:es/restrict-to-es2017` | disallow new stuff that ES2017 doesn't include.
| `plugin:es/restrict-to-es2016` | disallow new stuff that ES2016 doesn't include.
| `plugin:es/restrict-to-es2015` | disallow new stuff that ES2015 doesn't include.
| `plugin:es/restrict-to-es5` | disallow new stuff that ES5 doesn't include.
| `plugin:es/restrict-to-es3` | disallow new stuff that ES3 doesn't include.
| `plugin:es/no-new-in-es2020` | disallow the new stuff in ES2020.
| `plugin:es/no-new-in-es2019` | disallow the new stuff in ES2019.
| `plugin:es/no-new-in-es2018` | disallow the new stuff in ES2018.
| `plugin:es/no-new-in-es2017` | disallow the new stuff in ES2017.
| `plugin:es/no-new-in-es2016` | disallow the new stuff in ES2016.
| `plugin:es/no-new-in-es2015` | disallow the new stuff in ES2015.
| `plugin:es/no-new-in-es5` | disallow the new stuff in ES5.
| `plugin:es/no-new-in-esnext` | disallow the new stuff to be planned for the next yearly ECMAScript snapshot.<br>⚠️ This config will be changed in the minor versions of this plugin.
| `plugin:es/restrict-to-es2020` | disallow new stuff that ES2020 doesn't include. |
| `plugin:es/restrict-to-es2019` | disallow new stuff that ES2019 doesn't include. |
| `plugin:es/restrict-to-es2018` | disallow new stuff that ES2018 doesn't include. |
| `plugin:es/restrict-to-es2017` | disallow new stuff that ES2017 doesn't include. |
| `plugin:es/restrict-to-es2016` | disallow new stuff that ES2016 doesn't include. |
| `plugin:es/restrict-to-es2015` | disallow new stuff that ES2015 doesn't include. |
| `plugin:es/restrict-to-es5` | disallow new stuff that ES5 doesn't include. |
| `plugin:es/restrict-to-es3` | disallow new stuff that ES3 doesn't include. |
| `plugin:es/no-new-in-es2021` | disallow the new stuff in ES2021. |
| `plugin:es/no-new-in-es2020` | disallow the new stuff in ES2020. |
| `plugin:es/no-new-in-es2019` | disallow the new stuff in ES2019. |
| `plugin:es/no-new-in-es2018` | disallow the new stuff in ES2018. |
| `plugin:es/no-new-in-es2017` | disallow the new stuff in ES2017. |
| `plugin:es/no-new-in-es2016` | disallow the new stuff in ES2016. |
| `plugin:es/no-new-in-es2015` | disallow the new stuff in ES2015. |
| `plugin:es/no-new-in-es5` | disallow the new stuff in ES5. |
| `plugin:es/no-new-in-esnext` | disallow the new stuff to be planned for the next yearly ECMAScript snapshot.<br>⚠️ This config will be changed in the minor versions of this plugin. |

<!-- PRESETS_TABLE_END -->

For example:

Expand Down
22 changes: 14 additions & 8 deletions docs/rules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ This plugin provides the following rules.

- 🔧 mark means that the `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by the rule.

## ES2021
## ES2022

There is a config that enables the rules in this category: `plugin:es/no-new-in-esnext`

⚠️ No rules yet. It will be added in the future.

## ES2021

There are multiple configs that enable all rules in this category: `plugin:es/no-new-in-es2021`, `plugin:es/restrict-to-es3`, `plugin:es/restrict-to-es5`, `plugin:es/restrict-to-es2015`, `plugin:es/restrict-to-es2016`, `plugin:es/restrict-to-es2017`, `plugin:es/restrict-to-es2018`, `plugin:es/restrict-to-es2019`, and `plugin:es/restrict-to-es2020`

| Rule ID | Description | |
|:--------|:------------|:--:|
| [es/no-logical-assignment-operators](./no-logical-assignment-operators.md) | disallow logical assignment operators. | 🔧 |
Expand All @@ -18,7 +24,7 @@ There is a config that enables the rules in this category: `plugin:es/no-new-in-

## ES2020

There are multiple configs that enable all rules in this category: `plugin:es/no-new-in-es2020`, `plugin:es/restrict-to-es3`, `plugin:es/restrict-to-es5`, `plugin:es/restrict-to-es2015`, `plugin:es/restrict-to-es2016`, `plugin:es/restrict-to-es2017`, `plugin:es/restrict-to-es2018`, and `plugin:es/restrict-to-es2019`
There are multiple configs that enable all rules in this category: `plugin:es/no-new-in-es2020`, `plugin:es/restrict-to-es3`, `plugin:es/restrict-to-es5`, `plugin:es/restrict-to-es2015`, `plugin:es/restrict-to-es2016`, `plugin:es/restrict-to-es2017`, `plugin:es/restrict-to-es2018`, `plugin:es/restrict-to-es2019`, and `plugin:es/restrict-to-es2020`

| Rule ID | Description | |
|:--------|:------------|:--:|
Expand All @@ -34,7 +40,7 @@ There are multiple configs that enable all rules in this category: `plugin:es/no

## ES2019

There are multiple configs that enable all rules in this category: `plugin:es/no-new-in-es2019`, `plugin:es/restrict-to-es3`, `plugin:es/restrict-to-es5`, `plugin:es/restrict-to-es2015`, `plugin:es/restrict-to-es2016`, `plugin:es/restrict-to-es2017`, and `plugin:es/restrict-to-es2018`
There are multiple configs that enable all rules in this category: `plugin:es/no-new-in-es2019`, `plugin:es/restrict-to-es3`, `plugin:es/restrict-to-es5`, `plugin:es/restrict-to-es2015`, `plugin:es/restrict-to-es2016`, `plugin:es/restrict-to-es2017`, `plugin:es/restrict-to-es2018`, and `plugin:es/restrict-to-es2019`

| Rule ID | Description | |
|:--------|:------------|:--:|
Expand All @@ -48,7 +54,7 @@ There are multiple configs that enable all rules in this category: `plugin:es/no

## ES2018

There are multiple configs that enable all rules in this category: `plugin:es/no-new-in-es2018`, `plugin:es/restrict-to-es3`, `plugin:es/restrict-to-es5`, `plugin:es/restrict-to-es2015`, `plugin:es/restrict-to-es2016`, and `plugin:es/restrict-to-es2017`
There are multiple configs that enable all rules in this category: `plugin:es/no-new-in-es2018`, `plugin:es/restrict-to-es3`, `plugin:es/restrict-to-es5`, `plugin:es/restrict-to-es2015`, `plugin:es/restrict-to-es2016`, `plugin:es/restrict-to-es2017`, and `plugin:es/restrict-to-es2018`

| Rule ID | Description | |
|:--------|:------------|:--:|
Expand All @@ -63,7 +69,7 @@ There are multiple configs that enable all rules in this category: `plugin:es/no

## ES2017

There are multiple configs that enable all rules in this category: `plugin:es/no-new-in-es2017`, `plugin:es/restrict-to-es3`, `plugin:es/restrict-to-es5`, `plugin:es/restrict-to-es2015`, and `plugin:es/restrict-to-es2016`
There are multiple configs that enable all rules in this category: `plugin:es/no-new-in-es2017`, `plugin:es/restrict-to-es3`, `plugin:es/restrict-to-es5`, `plugin:es/restrict-to-es2015`, `plugin:es/restrict-to-es2016`, and `plugin:es/restrict-to-es2017`

| Rule ID | Description | |
|:--------|:------------|:--:|
Expand All @@ -78,7 +84,7 @@ There are multiple configs that enable all rules in this category: `plugin:es/no

## ES2016

There are multiple configs that enable all rules in this category: `plugin:es/no-new-in-es2016`, `plugin:es/restrict-to-es3`, `plugin:es/restrict-to-es5`, and `plugin:es/restrict-to-es2015`
There are multiple configs that enable all rules in this category: `plugin:es/no-new-in-es2016`, `plugin:es/restrict-to-es3`, `plugin:es/restrict-to-es5`, `plugin:es/restrict-to-es2015`, and `plugin:es/restrict-to-es2016`

| Rule ID | Description | |
|:--------|:------------|:--:|
Expand All @@ -87,7 +93,7 @@ There are multiple configs that enable all rules in this category: `plugin:es/no

## ES2015

There are multiple configs that enable all rules in this category: `plugin:es/no-new-in-es2015`, `plugin:es/restrict-to-es3`, and `plugin:es/restrict-to-es5`
There are multiple configs that enable all rules in this category: `plugin:es/no-new-in-es2015`, `plugin:es/restrict-to-es3`, `plugin:es/restrict-to-es5`, and `plugin:es/restrict-to-es2015`

| Rule ID | Description | |
|:--------|:------------|:--:|
Expand Down Expand Up @@ -173,7 +179,7 @@ There are multiple configs that enable all rules in this category: `plugin:es/no

## ES5

There are multiple configs that enable all rules in this category: `plugin:es/no-new-in-es5` and `plugin:es/restrict-to-es3`
There are multiple configs that enable all rules in this category: `plugin:es/no-new-in-es5`, `plugin:es/restrict-to-es3`, and `plugin:es/restrict-to-es5`

| Rule ID | Description | |
|:--------|:------------|:--:|
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-logical-assignment-operators.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# es/no-logical-assignment-operators
> disallow logical assignment operators

- ✅ The following configurations enable this rule: `plugin:es/no-new-in-esnext`
- ✅ The following configurations enable this rule: `plugin:es/no-new-in-es2021`, `plugin:es/restrict-to-es3`, `plugin:es/restrict-to-es5`, `plugin:es/restrict-to-es2015`, `plugin:es/restrict-to-es2016`, `plugin:es/restrict-to-es2017`, `plugin:es/restrict-to-es2018`, `plugin:es/restrict-to-es2019`, and `plugin:es/restrict-to-es2020`
- 🔧 The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.

This rule reports ES2021 [logical assignment operators](https://github.com/tc39/proposal-logical-assignment) as errors.
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-numeric-separators.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# es/no-numeric-separators
> disallow numeric separators

- ✅ The following configurations enable this rule: `plugin:es/no-new-in-esnext`
- ✅ The following configurations enable this rule: `plugin:es/no-new-in-es2021`, `plugin:es/restrict-to-es3`, `plugin:es/restrict-to-es5`, `plugin:es/restrict-to-es2015`, `plugin:es/restrict-to-es2016`, `plugin:es/restrict-to-es2017`, `plugin:es/restrict-to-es2018`, `plugin:es/restrict-to-es2019`, and `plugin:es/restrict-to-es2020`
- 🔧 The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.

This rule reports ES2021 [numeric separators](https://github.com/tc39/proposal-numeric-separator) as errors.
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-promise-any.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# es/no-promise-any
> disallow `Promise.any` function and `AggregateError` class

- ✅ The following configurations enable this rule: `plugin:es/no-new-in-esnext`
- ✅ The following configurations enable this rule: `plugin:es/no-new-in-es2021`, `plugin:es/restrict-to-es3`, `plugin:es/restrict-to-es5`, `plugin:es/restrict-to-es2015`, `plugin:es/restrict-to-es2016`, `plugin:es/restrict-to-es2017`, `plugin:es/restrict-to-es2018`, `plugin:es/restrict-to-es2019`, and `plugin:es/restrict-to-es2020`

This rule reports ES2021 [`Promise.any`](https://github.com/tc39/proposal-promise-any) as errors.
This proposal includes the following two:
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-string-prototype-replaceall.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# es/no-string-prototype-replaceall
> disallow the `String.prototype.replaceAll` method

- ✅ The following configurations enable this rule: `plugin:es/no-new-in-esnext`
- ✅ The following configurations enable this rule: `plugin:es/no-new-in-es2021`, `plugin:es/restrict-to-es3`, `plugin:es/restrict-to-es5`, `plugin:es/restrict-to-es2015`, `plugin:es/restrict-to-es2016`, `plugin:es/restrict-to-es2017`, `plugin:es/restrict-to-es2018`, `plugin:es/restrict-to-es2019`, and `plugin:es/restrict-to-es2020`

This rule reports ES2021 [`String.prototype.replaceAll` method](https://github.com/tc39/proposal-string-replaceall) as errors.

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-weakrefs.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# es/no-weakrefs
> disallow the `WeakRef` and `FinalizationRegistry` class

- ✅ The following configurations enable this rule: `plugin:es/no-new-in-esnext`
- ✅ The following configurations enable this rule: `plugin:es/no-new-in-es2021`, `plugin:es/restrict-to-es3`, `plugin:es/restrict-to-es5`, `plugin:es/restrict-to-es2015`, `plugin:es/restrict-to-es2016`, `plugin:es/restrict-to-es2017`, `plugin:es/restrict-to-es2018`, `plugin:es/restrict-to-es2019`, and `plugin:es/restrict-to-es2020`

This rule reports ES2021 [WeakRefs](https://github.com/tc39/proposal-weakrefs) as errors.
This proposal includes the following two:
Expand Down
16 changes: 16 additions & 0 deletions lib/configs/no-new-in-es2021.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* DON'T EDIT THIS FILE.
* This file was generated by "scripts/update-lib-configs.js" script.
*/
"use strict"

module.exports = {
plugins: ["es"],
rules: {
"es/no-logical-assignment-operators": "error",
"es/no-numeric-separators": "error",
"es/no-promise-any": "error",
"es/no-string-prototype-replaceall": "error",
"es/no-weakrefs": "error",
},
}
11 changes: 1 addition & 10 deletions lib/configs/no-new-in-esnext.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,4 @@
*/
"use strict"

module.exports = {
plugins: ["es"],
rules: {
"es/no-logical-assignment-operators": "error",
"es/no-numeric-separators": "error",
"es/no-promise-any": "error",
"es/no-string-prototype-replaceall": "error",
"es/no-weakrefs": "error",
},
}
module.exports = { plugins: ["es"], rules: {} }
1 change: 1 addition & 0 deletions lib/configs/restrict-to-es2015.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

module.exports = {
extends: [
require.resolve("./no-new-in-es2021"),
require.resolve("./no-new-in-es2020"),
require.resolve("./no-new-in-es2019"),
require.resolve("./no-new-in-es2018"),
Expand Down
1 change: 1 addition & 0 deletions lib/configs/restrict-to-es2016.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

module.exports = {
extends: [
require.resolve("./no-new-in-es2021"),
require.resolve("./no-new-in-es2020"),
require.resolve("./no-new-in-es2019"),
require.resolve("./no-new-in-es2018"),
Expand Down
1 change: 1 addition & 0 deletions lib/configs/restrict-to-es2017.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

module.exports = {
extends: [
require.resolve("./no-new-in-es2021"),
require.resolve("./no-new-in-es2020"),
require.resolve("./no-new-in-es2019"),
require.resolve("./no-new-in-es2018"),
Expand Down
1 change: 1 addition & 0 deletions lib/configs/restrict-to-es2018.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

module.exports = {
extends: [
require.resolve("./no-new-in-es2021"),
require.resolve("./no-new-in-es2020"),
require.resolve("./no-new-in-es2019"),
],
Expand Down
7 changes: 6 additions & 1 deletion lib/configs/restrict-to-es2019.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@
*/
"use strict"

module.exports = { extends: [require.resolve("./no-new-in-es2020")] }
module.exports = {
extends: [
require.resolve("./no-new-in-es2021"),
require.resolve("./no-new-in-es2020"),
],
}
7 changes: 7 additions & 0 deletions lib/configs/restrict-to-es2020.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* DON'T EDIT THIS FILE.
* This file was generated by "scripts/update-lib-configs.js" script.
*/
"use strict"

module.exports = { extends: [require.resolve("./no-new-in-es2021")] }
1 change: 1 addition & 0 deletions lib/configs/restrict-to-es3.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

module.exports = {
extends: [
require.resolve("./no-new-in-es2021"),
require.resolve("./no-new-in-es2020"),
require.resolve("./no-new-in-es2019"),
require.resolve("./no-new-in-es2018"),
Expand Down
1 change: 1 addition & 0 deletions lib/configs/restrict-to-es5.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

module.exports = {
extends: [
require.resolve("./no-new-in-es2021"),
require.resolve("./no-new-in-es2020"),
require.resolve("./no-new-in-es2019"),
require.resolve("./no-new-in-es2018"),
Expand Down
2 changes: 2 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = {
"no-new-in-es2018": require("./configs/no-new-in-es2018"),
"no-new-in-es2019": require("./configs/no-new-in-es2019"),
"no-new-in-es2020": require("./configs/no-new-in-es2020"),
"no-new-in-es2021": require("./configs/no-new-in-es2021"),
"no-new-in-esnext": require("./configs/no-new-in-esnext"),
"restrict-to-es3": require("./configs/restrict-to-es3"),
"restrict-to-es5": require("./configs/restrict-to-es5"),
Expand All @@ -23,6 +24,7 @@ module.exports = {
"restrict-to-es2017": require("./configs/restrict-to-es2017"),
"restrict-to-es2018": require("./configs/restrict-to-es2018"),
"restrict-to-es2019": require("./configs/restrict-to-es2019"),
"restrict-to-es2020": require("./configs/restrict-to-es2020"),
get "no-5"() {
printWarningOfDeprecatedConfig("no-5")
return this["no-new-in-es5"]
Expand Down
2 changes: 1 addition & 1 deletion scripts/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const libRoot = path.resolve(__dirname, "../lib/rules")
*/

/** @type {Record<string, Category>} */
const categories = [12, 11, 10, 9, 8, 7, 6, 5].reduce(
const categories = [13, 12, 11, 10, 9, 8, 7, 6, 5].reduce(
(map, revision, _, [latest]) => {
const year = revision <= 5 ? 5 : 2009 + revision
const id = `ES${year}`
Expand Down
Loading