Skip to content

Commit

Permalink
feature: @putout/plugin-for-of: add-missing-star: move out to generators
Browse files Browse the repository at this point in the history
  • Loading branch information
coderaiser committed May 10, 2024
1 parent bc4dc53 commit e674127
Show file tree
Hide file tree
Showing 12 changed files with 0 additions and 137 deletions.
33 changes: 0 additions & 33 deletions packages/plugin-for-of/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ npm i @putout/plugin-for-of

## Rules

-[add-missing-star](#add-missing-star);
-[for-each](#for-each);
-[for-entries](#for-entries);
-[for-entries-n](#for-entries-n);
Expand All @@ -37,7 +36,6 @@ npm i @putout/plugin-for-of
```json
{
"rules": {
"for-of/add-missing-star": "on",
"for-of/map": "on",
"for-of/for-in": "on",
"for-of/for-each": "on",
Expand All @@ -53,37 +51,6 @@ npm i @putout/plugin-for-of
}
```

## add-missing-star

> The `function*` declaration creates a binding of a new generator function to a given name.
>
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*)
### ❌ Example of incorrect code

```js
function hello() {
yield;
'world';
}

function func2() {
yield * func1();
}
```

### ✅ Example of correct code

```js
function* hello() {
yield 'world';
}

function* func2() {
yield* func1();
}
```

## map

> The [`map()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) method creates a new array populated with the results of calling a provided function on every element in the calling array.
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

47 changes: 0 additions & 47 deletions packages/plugin-for-of/lib/add-missing-star/index.js

This file was deleted.

31 changes: 0 additions & 31 deletions packages/plugin-for-of/lib/add-missing-star/index.spec.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/plugin-for-of/lib/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const addMissingStar = require('./add-missing-star');
const map = require('./map');
const forEach = require('./for-each');
const forN = require('./for-n');
Expand All @@ -16,7 +15,6 @@ const removeUselessArrayFrom = require('./remove-useless-array-from');
const removeUnusedVariables = require('./remove-unused-variables');

module.exports.rules = {
'add-missing-star': addMissingStar,
map,
'for-each': forEach,
'for-n': forN,
Expand Down
3 changes: 0 additions & 3 deletions packages/plugin-for-of/test/fixture/add-missing-star-fix.js

This file was deleted.

3 changes: 0 additions & 3 deletions packages/plugin-for-of/test/fixture/add-missing-star.js

This file was deleted.

5 changes: 0 additions & 5 deletions packages/plugin-for-of/test/for-of.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,3 @@ test('plugin-for-of: transform: remove-useless-variables', (t) => {
t.transform('remove-useless-variables');
t.end();
});

test('plugin-for-of: transform: add-missing-start', (t) => {
t.transform('add-missing-star');
t.end();
});

0 comments on commit e674127

Please sign in to comment.