-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: separate the rules of ES2022 - ES2024 by features (#150)
- Loading branch information
Showing
76 changed files
with
2,954 additions
and
236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
title: "es-x/no-array-prototype-at" | ||
description: "disallow the `Array.prototype.at()` methods" | ||
--- | ||
|
||
# es-x/no-array-prototype-at | ||
> disallow the `Array.prototype.at()` methods | ||
- ❗ <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-new-in-es2022], [no-relative-indexing-method], [restrict-to-es3], [restrict-to-es5], [restrict-to-es2015], [restrict-to-es2016], [restrict-to-es2017], [restrict-to-es2018], [restrict-to-es2019], [restrict-to-es2020], and [restrict-to-es2021] | ||
|
||
This rule reports ES2022 [`{Array,TypedArray}.prototype.at` methods](https://github.com/tc39/proposal-relative-indexing-method) as errors. | ||
|
||
This rule is silent by default because it's hard to know types. You need to configure [the aggressive mode](../#the-aggressive-mode) or TypeScript in order to enable this rule. | ||
|
||
## 💡 Examples | ||
|
||
⛔ Examples of **incorrect** code for this rule: | ||
|
||
<eslint-playground type="bad"> | ||
|
||
```js | ||
/*eslint es-x/no-array-prototype-at: [error, { aggressive: true }] */ | ||
[foo].at(-1) | ||
``` | ||
|
||
</eslint-playground> | ||
|
||
## 🔧 Options | ||
|
||
This rule has an option. | ||
|
||
```yaml | ||
rules: | ||
es-x/no-array-prototype-at: [error, { aggressive: false }] | ||
``` | ||
### aggressive: boolean | ||
Configure the aggressive mode for only this rule. | ||
This is prior to the `settings['es-x'].aggressive` setting. | ||
|
||
## 📚 References | ||
|
||
- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-array-prototype-at.js) | ||
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-array-prototype-at.js) | ||
|
||
[no-new-in-es2022]: ../configs/index.md#no-new-in-es2022 | ||
[no-relative-indexing-method]: ../configs/index.md#no-relative-indexing-method | ||
[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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.