Skip to content

Commit ab6ec6e

Browse files
committed
feature(@putout/plugin-nodejs) add
1 parent fade286 commit ab6ec6e

File tree

33 files changed

+266
-13
lines changed

33 files changed

+266
-13
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,15 @@ interface A {
425425

426426
</details>
427427

428+
<details><summary>convert <code>fs.promises</code> to <code>fs/promises</code> for <a href=https://nodejs.org/dist/latest-v15.x/docs/api/fs.html#fs_fs_promises_api>node.js</a></summary>
429+
430+
```diff
431+
-const {readFile} = require('fs').promises;
432+
+const {readFile} = require('fs/promises');
433+
```
434+
435+
</details>
436+
428437
<details><summary>remove useless <code>types</code> for typescript</summary>
429438

430439
```diff
@@ -1102,6 +1111,7 @@ Next packages not bundled with `putout` but can be installed separately.
11021111
| [`@putout/plugin-browserlist`](/packages/plugin-browserlist) | [![npm](https://img.shields.io/npm/v/@putout/plugin-browserlist.svg?maxAge=86400)](https://www.npmjs.com/package/@putout/plugin-browserlist) | [![Dependency Status](https://david-dm.org/coderaiser/putout.svg?path=packages/plugin-browserlist)](https://david-dm.org/coderaiser/putout?path=packages/plugin-browserlist) |
11031112
| [`@putout/plugin-travis`](/packages/plugin-travis) | [![npm](https://img.shields.io/npm/v/@putout/plugin-travis.svg?maxAge=86400)](https://www.npmjs.com/package/@putout/plugin-travis) | [![Dependency Status](https://david-dm.org/coderaiser/putout.svg?path=packages/plugin-travis)](https://david-dm.org/coderaiser/putout?path=packages/plugin-travis) |
11041113
| [`@putout/plugin-regexp`](/packages/plugin-regexp) | [![npm](https://img.shields.io/npm/v/@putout/plugin-regexp.svg?maxAge=86400)](https://www.npmjs.com/package/@putout/plugin-regexp) | [![Dependency Status](https://david-dm.org/coderaiser/putout.svg?path=packages/plugin-regexp)](https://david-dm.org/coderaiser/putout?path=packages/plugin-regexp) |
1114+
| [`@putout/plugin-nodejs`](/packages/plugin-nodejs) | [![npm](https://img.shields.io/npm/v/@putout/plugin-nodejs.svg?maxAge=86400)](https://www.npmjs.com/package/@putout/plugin-nodejs) | [![Dependency Status](https://david-dm.org/coderaiser/putout.svg?path=packages/plugin-nodejs)](https://david-dm.org/coderaiser/putout?path=packages/plugin-nodejs) |
11051115

11061116
## Formatters
11071117

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"match": {
3+
"*.md": {
4+
"nodejs": "off"
5+
}
6+
}
7+
}

packages/engine-processor/test/processor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
const {readFile} = require('fs').promises;
3+
const {readFile} = require('fs/promises');
44
const {join} = require('path');
55

66
const test = require('supertape');
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use strict';
2+
3+
module.exports = {
4+
extends: [
5+
'plugin:putout/recommended',
6+
'plugin:node/recommended',
7+
],
8+
plugins: [
9+
'node',
10+
'putout',
11+
],
12+
};

packages/plugin-nodejs/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
.nyc_output
3+
*.swp
4+
yarn-error.log
5+
6+
.putoutcache

packages/plugin-nodejs/.madrun.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
'use strict';
2+
3+
const {run} = require('madrun');
4+
5+
module.exports = {
6+
'prepublishOnly': () => run(['lint', 'test']),
7+
'test': () => `tape 'test/*.js' 'lib/**/*.spec.js'`,
8+
'watch:test': async () => `nodemon -w lib -x ${await run('test')}`,
9+
'lint': () => 'putout .',
10+
'fresh:lint': () => run('lint', '--fresh'),
11+
'lint:fresh': () => run('lint', '--fresh'),
12+
'fix:lint': () => run('lint', '--fix'),
13+
'coverage': async () => `nyc ${await run('test')}`,
14+
'report': () => `nyc report --reporter=text-lcov | coveralls || true`,
15+
};
16+

packages/plugin-nodejs/.npmignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.*
2+
*.spec.js
3+
test
4+
fixture
5+
yarn-error.log
6+
7+
madrun.js

packages/plugin-nodejs/.nycrc.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"check-coverage": true,
3+
"all": true,
4+
"exclude": [
5+
"**/*.spec.js",
6+
"**/fixture",
7+
"test",
8+
".*.js"
9+
],
10+
"branches": 100,
11+
"lines": 100,
12+
"functions": 100,
13+
"statements": 100
14+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"match": {
3+
"*.md": {
4+
"nodejs": "off"
5+
}
6+
}
7+
}

packages/plugin-nodejs/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) coderaiser
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)