Skip to content

Commit 13c61b1

Browse files
committed
Breaking: update plugin:node/recommended
1 parent 95b8164 commit 13c61b1

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

README.md

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,6 @@ Additional ESLint's rules for Node.js
1717
- Requires Node.js `^0.10.0 || ^0.12.0 || ^4.0.0 || >=6.0.0`
1818
- Requires ESLint `>=2.0.0`
1919

20-
## :wrench: Configs
21-
22-
This plugin provides `plugin:node/recommended` preset config.
23-
This preset config:
24-
25-
- enables the environment of ES2015 (ES6) and Node.js.
26-
- enables rules which are given :star: in the following table.
27-
2820
**Note:** It recommends a use of [the "engines" field of package.json](https://docs.npmjs.com/files/package.json#engines). The "engines" field is used by [no-unsupported-features](docs/rules/no-unsupported-features.md) rule.
2921

3022
**.eslintrc.json** (An example)
@@ -35,8 +27,6 @@ This preset config:
3527
"extends": ["eslint:recommended", "plugin:node/recommended"],
3628
"rules": {
3729
"node/exports-style": ["error", "module.exports"],
38-
"node/no-unpublished-bin": "error",
39-
"node/process-exit-as-throw": "error"
4030
}
4131
}
4232
```
@@ -45,8 +35,10 @@ This preset config:
4535

4636
```json
4737
{
38+
"name": "your-module",
39+
"version": "1.0.0",
4840
"engines": {
49-
"node": ">=4"
41+
"node": ">=4.0.0"
5042
}
5143
}
5244
```
@@ -59,16 +51,26 @@ This preset config:
5951
| :star: | | [no-deprecated-api](docs/rules/no-deprecated-api.md) | Disallow deprecated API.
6052
| | | [no-missing-import](docs/rules/no-missing-import.md) | Disallow `import` declarations for files that don't exist. :warning:
6153
| :star: | | [no-missing-require](docs/rules/no-missing-require.md) | Disallow `require()`s for files that don't exist.
62-
| | | [no-unpublished-bin](docs/rules/no-unpublished-bin.md) | Disallow `bin` files that npm ignores.
54+
| :star: | | [no-unpublished-bin](docs/rules/no-unpublished-bin.md) | Disallow `bin` files that npm ignores.
6355
| | | [no-unpublished-import](docs/rules/no-unpublished-import.md) | Disallow `import` declarations for files that npm ignores. :warning:
6456
| :star: | | [no-unpublished-require](docs/rules/no-unpublished-require.md) | Disallow `require()`s for files that npm ignores.
6557
| :star: | | [no-unsupported-features](docs/rules/no-unsupported-features.md) | Disallow unsupported ECMAScript features on the specified version.
66-
| | | [process-exit-as-throw](docs/rules/process-exit-as-throw.md) | Make the same code path as throw at `process.exit()`.
58+
| :star: | | [process-exit-as-throw](docs/rules/process-exit-as-throw.md) | Make the same code path as throw at `process.exit()`.
6759
| :star: | :pencil: | [shebang](docs/rules/shebang.md) | Suggest correct usage of shebang.
6860

6961
- :star: - the mark of a recommended rule.
7062
- :pencil: - the mark of a fixable rule.
7163

64+
## :wrench: Configs
65+
66+
This plugin provides `plugin:node/recommended` preset config.
67+
This preset config:
68+
69+
- enables the environment of ES2015 (ES6) and Node.js.
70+
- enables rules which are given :star: in the above table.
71+
- enables [no-process-exit](http://eslint.org/docs/rules/no-process-exit) rule because [the official document](https://nodejs.org/api/process.html#process_process_exit_code) does not recommend a use of `process.exit()`.
72+
- adds `{ecmaVersion: 8}` into `parserOptions`.
73+
7274
## :couple: FAQ
7375

7476
- Q: The `no-missing-import` / `no-missing-require` rules don't work with nested folders in SublimeLinter-eslint
@@ -79,18 +81,19 @@ This preset config:
7981
`eslint-plugin-node` follows [semantic versioning](http://semver.org/) and [ESLint's Semantic Versioning Policy](https://github.com/eslint/eslint#semantic-versioning-policy).
8082

8183
- Patch release (intended to not break your lint build)
82-
- A bug fix in a rule that results in `eslint-plugin-node` reporting fewer errors.
84+
- A bug fix in a rule that results in it reporting fewer errors.
8385
- Improvements to documentation.
8486
- Non-user-facing changes such as refactoring code, adding, deleting, or modifying tests, and increasing test coverage.
8587
- Re-releasing after a failed release (i.e., publishing a release that doesn't work for anyone).
8688
- Minor release (might break your lint build)
87-
- A bug fix in a rule that results in `eslint-plugin-node` reporting more errors.
89+
- A bug fix in a rule that results in it reporting more errors.
8890
- A new rule is created.
8991
- A new option to an existing rule is created.
9092
- An existing rule is deprecated.
9193
- Major release (likely to break your lint build)
9294
- A support for old Node version is dropped.
9395
- A support for old ESLint version is dropped.
96+
- An existing rule is changed in it reporting more errors.
9497
- An existing rule is removed.
9598
- An existing option of a rule is removed.
9699
- An existing config is updated.

conf/recommended.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"parserOptions": {
3+
"ecmaVersion": 8
4+
},
25
"env": {
36
"es6": true,
47
"node": true
@@ -7,8 +10,10 @@
710
"no-process-exit": "error",
811
"node/no-deprecated-api": "error",
912
"node/no-missing-require": "error",
13+
"node/no-unpublished-bin": "error",
1014
"node/no-unpublished-require": "error",
1115
"node/no-unsupported-features": "error",
16+
"node/process-exit-as-throw": "error",
1217
"node/shebang": "error"
1318
}
1419
}

0 commit comments

Comments
 (0)