-
-
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.
Add
no-iterator-helpers
rules (#211)
- Loading branch information
Showing
56 changed files
with
4,694 additions
and
265 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ | |
"javascript", | ||
"vue" | ||
], | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
title: "es-x/no-iterator-prototype-drop" | ||
description: "disallow the `Iterator.prototype.drop` method" | ||
--- | ||
|
||
# es-x/no-iterator-prototype-drop | ||
> disallow the `Iterator.prototype.drop` method | ||
- ❗ <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-iterator-helpers] and [no-new-in-esnext] | ||
|
||
This rule reports ES2025 [`Iterator.prototype.drop`](https://github.com/tc39/proposal-iterator-helpers) as errors.\ | ||
|
||
## 💡 Examples | ||
|
||
⛔ Examples of **incorrect** code for this rule: | ||
|
||
<eslint-playground type="bad"> | ||
|
||
```js | ||
/*eslint es-x/no-iterator-prototype-drop: error */ | ||
const result = naturals() | ||
.drop(3); | ||
|
||
function* naturals() { | ||
// ... | ||
} | ||
``` | ||
|
||
</eslint-playground> | ||
|
||
## 📚 References | ||
|
||
- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-iterator-prototype-drop.js) | ||
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-iterator-prototype-drop.js) | ||
|
||
[no-iterator-helpers]: ../configs/index.md#no-iterator-helpers | ||
[no-new-in-esnext]: ../configs/index.md#no-new-in-esnext |
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,38 @@ | ||
--- | ||
title: "es-x/no-iterator-prototype-every" | ||
description: "disallow the `Iterator.prototype.every` method" | ||
--- | ||
|
||
# es-x/no-iterator-prototype-every | ||
> disallow the `Iterator.prototype.every` method | ||
- ❗ <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-iterator-helpers] and [no-new-in-esnext] | ||
|
||
This rule reports ES2025 [`Iterator.prototype.every`](https://github.com/tc39/proposal-iterator-helpers) as errors.\ | ||
|
||
## 💡 Examples | ||
|
||
⛔ Examples of **incorrect** code for this rule: | ||
|
||
<eslint-playground type="bad"> | ||
|
||
```js | ||
/*eslint es-x/no-iterator-prototype-every: error */ | ||
const result = naturals() | ||
.every(n => n % 2); | ||
|
||
function* naturals() { | ||
// ... | ||
} | ||
``` | ||
|
||
</eslint-playground> | ||
|
||
## 📚 References | ||
|
||
- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-iterator-prototype-every.js) | ||
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-iterator-prototype-every.js) | ||
|
||
[no-iterator-helpers]: ../configs/index.md#no-iterator-helpers | ||
[no-new-in-esnext]: ../configs/index.md#no-new-in-esnext |
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,38 @@ | ||
--- | ||
title: "es-x/no-iterator-prototype-filter" | ||
description: "disallow the `Iterator.prototype.filter` method" | ||
--- | ||
|
||
# es-x/no-iterator-prototype-filter | ||
> disallow the `Iterator.prototype.filter` method | ||
- ❗ <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-iterator-helpers] and [no-new-in-esnext] | ||
|
||
This rule reports ES2025 [`Iterator.prototype.filter`](https://github.com/tc39/proposal-iterator-helpers) as errors.\ | ||
|
||
## 💡 Examples | ||
|
||
⛔ Examples of **incorrect** code for this rule: | ||
|
||
<eslint-playground type="bad"> | ||
|
||
```js | ||
/*eslint es-x/no-iterator-prototype-filter: error */ | ||
const result = naturals() | ||
.filter(n => n % 2); | ||
|
||
function* naturals() { | ||
// ... | ||
} | ||
``` | ||
|
||
</eslint-playground> | ||
|
||
## 📚 References | ||
|
||
- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-iterator-prototype-filter.js) | ||
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-iterator-prototype-filter.js) | ||
|
||
[no-iterator-helpers]: ../configs/index.md#no-iterator-helpers | ||
[no-new-in-esnext]: ../configs/index.md#no-new-in-esnext |
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,38 @@ | ||
--- | ||
title: "es-x/no-iterator-prototype-find" | ||
description: "disallow the `Iterator.prototype.find` method" | ||
--- | ||
|
||
# es-x/no-iterator-prototype-find | ||
> disallow the `Iterator.prototype.find` method | ||
- ❗ <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-iterator-helpers] and [no-new-in-esnext] | ||
|
||
This rule reports ES2025 [`Iterator.prototype.find`](https://github.com/tc39/proposal-iterator-helpers) as errors.\ | ||
|
||
## 💡 Examples | ||
|
||
⛔ Examples of **incorrect** code for this rule: | ||
|
||
<eslint-playground type="bad"> | ||
|
||
```js | ||
/*eslint es-x/no-iterator-prototype-find: error */ | ||
const result = naturals() | ||
.find(n => n % 2); | ||
|
||
function* naturals() { | ||
// ... | ||
} | ||
``` | ||
|
||
</eslint-playground> | ||
|
||
## 📚 References | ||
|
||
- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-iterator-prototype-find.js) | ||
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-iterator-prototype-find.js) | ||
|
||
[no-iterator-helpers]: ../configs/index.md#no-iterator-helpers | ||
[no-new-in-esnext]: ../configs/index.md#no-new-in-esnext |
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,38 @@ | ||
--- | ||
title: "es-x/no-iterator-prototype-flatmap" | ||
description: "disallow the `Iterator.prototype.flatMap` method" | ||
--- | ||
|
||
# es-x/no-iterator-prototype-flatmap | ||
> disallow the `Iterator.prototype.flatMap` method | ||
- ❗ <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-iterator-helpers] and [no-new-in-esnext] | ||
|
||
This rule reports ES2025 [`Iterator.prototype.flatMap`](https://github.com/tc39/proposal-iterator-helpers) as errors.\ | ||
|
||
## 💡 Examples | ||
|
||
⛔ Examples of **incorrect** code for this rule: | ||
|
||
<eslint-playground type="bad"> | ||
|
||
```js | ||
/*eslint es-x/no-iterator-prototype-flatmap: error */ | ||
const result = naturals() | ||
.flatMap(n => [n, -n]); | ||
|
||
function* naturals() { | ||
// ... | ||
} | ||
``` | ||
|
||
</eslint-playground> | ||
|
||
## 📚 References | ||
|
||
- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-iterator-prototype-flatmap.js) | ||
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-iterator-prototype-flatmap.js) | ||
|
||
[no-iterator-helpers]: ../configs/index.md#no-iterator-helpers | ||
[no-new-in-esnext]: ../configs/index.md#no-new-in-esnext |
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,38 @@ | ||
--- | ||
title: "es-x/no-iterator-prototype-foreach" | ||
description: "disallow the `Iterator.prototype.forEach` method" | ||
--- | ||
|
||
# es-x/no-iterator-prototype-foreach | ||
> disallow the `Iterator.prototype.forEach` method | ||
- ❗ <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-iterator-helpers] and [no-new-in-esnext] | ||
|
||
This rule reports ES2025 [`Iterator.prototype.forEach`](https://github.com/tc39/proposal-iterator-helpers) as errors.\ | ||
|
||
## 💡 Examples | ||
|
||
⛔ Examples of **incorrect** code for this rule: | ||
|
||
<eslint-playground type="bad"> | ||
|
||
```js | ||
/*eslint es-x/no-iterator-prototype-foreach: error */ | ||
const result = naturals() | ||
.forEach(n => {/* ... */}); | ||
|
||
function* naturals() { | ||
// ... | ||
} | ||
``` | ||
|
||
</eslint-playground> | ||
|
||
## 📚 References | ||
|
||
- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-iterator-prototype-foreach.js) | ||
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-iterator-prototype-foreach.js) | ||
|
||
[no-iterator-helpers]: ../configs/index.md#no-iterator-helpers | ||
[no-new-in-esnext]: ../configs/index.md#no-new-in-esnext |
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,38 @@ | ||
--- | ||
title: "es-x/no-iterator-prototype-map" | ||
description: "disallow the `Iterator.prototype.map` method" | ||
--- | ||
|
||
# es-x/no-iterator-prototype-map | ||
> disallow the `Iterator.prototype.map` method | ||
- ❗ <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-iterator-helpers] and [no-new-in-esnext] | ||
|
||
This rule reports ES2025 [`Iterator.prototype.map`](https://github.com/tc39/proposal-iterator-helpers) as errors.\ | ||
|
||
## 💡 Examples | ||
|
||
⛔ Examples of **incorrect** code for this rule: | ||
|
||
<eslint-playground type="bad"> | ||
|
||
```js | ||
/*eslint es-x/no-iterator-prototype-map: error */ | ||
const result = naturals() | ||
.map(n => n % 2); | ||
|
||
function* naturals() { | ||
// ... | ||
} | ||
``` | ||
|
||
</eslint-playground> | ||
|
||
## 📚 References | ||
|
||
- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-iterator-prototype-map.js) | ||
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-iterator-prototype-map.js) | ||
|
||
[no-iterator-helpers]: ../configs/index.md#no-iterator-helpers | ||
[no-new-in-esnext]: ../configs/index.md#no-new-in-esnext |
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,38 @@ | ||
--- | ||
title: "es-x/no-iterator-prototype-reduce" | ||
description: "disallow the `Iterator.prototype.reduce` method" | ||
--- | ||
|
||
# es-x/no-iterator-prototype-reduce | ||
> disallow the `Iterator.prototype.reduce` method | ||
- ❗ <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-iterator-helpers] and [no-new-in-esnext] | ||
|
||
This rule reports ES2025 [`Iterator.prototype.reduce`](https://github.com/tc39/proposal-iterator-helpers) as errors.\ | ||
|
||
## 💡 Examples | ||
|
||
⛔ Examples of **incorrect** code for this rule: | ||
|
||
<eslint-playground type="bad"> | ||
|
||
```js | ||
/*eslint es-x/no-iterator-prototype-reduce: error */ | ||
const result = naturals() | ||
.reduce((sum, value) => sum + value, 3); | ||
|
||
function* naturals() { | ||
// ... | ||
} | ||
``` | ||
|
||
</eslint-playground> | ||
|
||
## 📚 References | ||
|
||
- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-iterator-prototype-reduce.js) | ||
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-iterator-prototype-reduce.js) | ||
|
||
[no-iterator-helpers]: ../configs/index.md#no-iterator-helpers | ||
[no-new-in-esnext]: ../configs/index.md#no-new-in-esnext |
Oops, something went wrong.