Skip to content

Commit 26c90b1

Browse files
committed
docs: update ruleId in docs/rules/*
1 parent 77ea5dc commit 26c90b1

39 files changed

+206
-206
lines changed

docs/rules/callback-return.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# node/callback-return
1+
# n/callback-return
22
> require `return` statements after callbacks
33
44
The callback pattern is at the heart of most I/O and event-driven programming
@@ -32,7 +32,7 @@ The rule takes a single option - an array of possible callback names - which may
3232
Examples of **incorrect** code for this rule with the default `["callback", "cb", "next"]` option:
3333

3434
```js
35-
/*eslint node/callback-return: "error"*/
35+
/*eslint n/callback-return: "error"*/
3636

3737
function foo(err, callback) {
3838
if (err) {
@@ -45,7 +45,7 @@ function foo(err, callback) {
4545
Examples of **correct** code for this rule with the default `["callback", "cb", "next"]` option:
4646

4747
```js
48-
/*eslint node/callback-return: "error"*/
48+
/*eslint n/callback-return: "error"*/
4949

5050
function foo(err, callback) {
5151
if (err) {
@@ -60,7 +60,7 @@ function foo(err, callback) {
6060
Examples of **incorrect** code for this rule with the option `["done", "send.error", "send.success"]`:
6161

6262
```js
63-
/*eslint node/callback-return: ["error", ["done", "send.error", "send.success"]]*/
63+
/*eslint n/callback-return: ["error", ["done", "send.error", "send.success"]]*/
6464

6565
function foo(err, done) {
6666
if (err) {

docs/rules/exports-style.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# node/exports-style
1+
# n/exports-style
22
> enforce either `module.exports` or `exports`
33
44
`module.exports` and `exports` are the same instance by default.
@@ -29,7 +29,7 @@ This rule has a string option.
2929

3030
```json
3131
{
32-
"node/exports-style": [
32+
"n/exports-style": [
3333
"error",
3434
"module.exports" or "exports",
3535
{
@@ -48,7 +48,7 @@ This rule has a string option.
4848
Examples of :-1: **incorrect** code for the `"module.exports"` option:
4949

5050
```js
51-
/*eslint node/exports-style: ["error", "module.exports"]*/
51+
/*eslint n/exports-style: ["error", "module.exports"]*/
5252

5353
exports.foo = 1
5454
exports.bar = 2
@@ -57,7 +57,7 @@ exports.bar = 2
5757
Examples of :+1: **correct** code for the `"module.exports"` option:
5858

5959
```js
60-
/*eslint node/exports-style: ["error", "module.exports"]*/
60+
/*eslint n/exports-style: ["error", "module.exports"]*/
6161

6262
module.exports = {
6363
foo: 1,
@@ -72,7 +72,7 @@ module.exports.baz = 3
7272
Examples of :-1: **incorrect** code for the `"exports"` option:
7373

7474
```js
75-
/*eslint node/exports-style: ["error", "exports"]*/
75+
/*eslint n/exports-style: ["error", "exports"]*/
7676

7777
module.exports = {
7878
foo: 1,
@@ -85,7 +85,7 @@ module.exports.baz = 3
8585
Examples of :+1: **correct** code for the `"exports"` option:
8686

8787
```js
88-
/*eslint node/exports-style: ["error", "exports"]*/
88+
/*eslint n/exports-style: ["error", "exports"]*/
8989

9090
exports.foo = 1
9191
exports.bar = 2
@@ -96,7 +96,7 @@ exports.bar = 2
9696
Examples of :+1: **correct** code for the `"exports"` and `{"allowBatchAssign": true}` option:
9797

9898
```js
99-
/*eslint node/exports-style: ["error", "exports", {"allowBatchAssign": true}]*/
99+
/*eslint n/exports-style: ["error", "exports", {"allowBatchAssign": true}]*/
100100

101101
// Allow `module.exports` in the same assignment expression as `exports`.
102102
module.exports = exports = function foo() {

docs/rules/file-extension-in-import.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# node/file-extension-in-import
1+
# n/file-extension-in-import
22
> enforce the style of file extensions in `import` declarations
33
> - ✒️ The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
44
@@ -23,7 +23,7 @@ This rule has a string option and an object option.
2323

2424
```json
2525
{
26-
"node/file-extension-in-import": [
26+
"n/file-extension-in-import": [
2727
"error",
2828
"always" or "never",
2929
{
@@ -44,15 +44,15 @@ This rule has a string option and an object option.
4444
Examples of :-1: **incorrect** code for the `"always"` option:
4545

4646
```js
47-
/*eslint node/file-extension-in-import: ["error", "always"]*/
47+
/*eslint n/file-extension-in-import: ["error", "always"]*/
4848

4949
import foo from "./path/to/a/file"
5050
```
5151

5252
Examples of :+1: **correct** code for the `"always"` option:
5353

5454
```js
55-
/*eslint node/file-extension-in-import: ["error", "always"]*/
55+
/*eslint n/file-extension-in-import: ["error", "always"]*/
5656

5757
import eslint from "eslint"
5858
import foo from "./path/to/a/file.js"
@@ -63,15 +63,15 @@ import foo from "./path/to/a/file.js"
6363
Examples of :-1: **incorrect** code for the `"never"` option:
6464

6565
```js
66-
/*eslint node/file-extension-in-import: ["error", "never"]*/
66+
/*eslint n/file-extension-in-import: ["error", "never"]*/
6767

6868
import foo from "./path/to/a/file.js"
6969
```
7070

7171
Examples of :+1: **correct** code for the `"never"` option:
7272

7373
```js
74-
/*eslint node/file-extension-in-import: ["error", "never"]*/
74+
/*eslint n/file-extension-in-import: ["error", "never"]*/
7575

7676
import eslint from "eslint"
7777
import foo from "./path/to/a/file"
@@ -82,7 +82,7 @@ import foo from "./path/to/a/file"
8282
Examples of :+1: **correct** code for the `["always", { ".js": "never" }]` option:
8383

8484
```js
85-
/*eslint node/file-extension-in-import: ["error", "always", { ".js": "never" }]*/
85+
/*eslint n/file-extension-in-import: ["error", "always", { ".js": "never" }]*/
8686

8787
import eslint from "eslint"
8888
import script from "./script"
@@ -106,7 +106,7 @@ module.exports = {
106106
}
107107
},
108108
"rules": {
109-
"node/file-extension-in-import": "error"
109+
"n/file-extension-in-import": "error"
110110
}
111111
}
112112
```

docs/rules/global-require.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# node/global-require
1+
# n/global-require
22
> require `require()` calls to be placed at top-level module scope
33
44
In Node.js, module dependencies are included using the `require()` function, such as:
@@ -29,7 +29,7 @@ This rule requires all calls to `require()` to be at the top level of the module
2929
Examples of **incorrect** code for this rule:
3030

3131
```js
32-
/*eslint node/global-require: "error"*/
32+
/*eslint n/global-require: "error"*/
3333
/*eslint-env es6*/
3434

3535
// calling require() inside of a function is not allowed
@@ -61,7 +61,7 @@ try {
6161
Examples of **correct** code for this rule:
6262

6363
```js
64-
/*eslint node/global-require: "error"*/
64+
/*eslint n/global-require: "error"*/
6565

6666
// all these variations of require() are ok
6767
require('x');

docs/rules/handle-callback-err.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# node/handle-callback-err
1+
# n/handle-callback-err
22
> require error handling in callbacks
33
44
In Node.js, a common pattern for dealing with asynchronous behavior is called the callback pattern.
@@ -22,7 +22,7 @@ The rule takes a single string option: the name of the error parameter. The defa
2222
Examples of **incorrect** code for this rule with the default `"err"` parameter name:
2323

2424
```js
25-
/*eslint node/handle-callback-err: "error"*/
25+
/*eslint n/handle-callback-err: "error"*/
2626

2727
function loadData (err, data) {
2828
doSomething();
@@ -33,7 +33,7 @@ function loadData (err, data) {
3333
Examples of **correct** code for this rule with the default `"err"` parameter name:
3434

3535
```js
36-
/*eslint node/handle-callback-err: "error"*/
36+
/*eslint n/handle-callback-err: "error"*/
3737

3838
function loadData (err, data) {
3939
if (err) {
@@ -50,7 +50,7 @@ function generateError (err) {
5050
Examples of **correct** code for this rule with a sample `"error"` parameter name:
5151

5252
```js
53-
/*eslint node/handle-callback-err: ["error", "error"]*/
53+
/*eslint n/handle-callback-err: ["error", "error"]*/
5454

5555
function loadData (error, data) {
5656
if (error) {

docs/rules/no-callback-literal.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# node/no-callback-literal
1+
# n/no-callback-literal
22
> ensure Node.js-style error-first callback pattern is followed
33
44
When invoking a callback function which uses the Node.js error-first callback pattern, all of your errors should either use the `Error` class or a subclass of it. It is also acceptable to use `undefined` or `null` if there is no error.
@@ -10,7 +10,7 @@ When a function is named `cb` or `callback`, then it must be invoked with a firs
1010
Examples of :-1: **incorrect** code for this rule:
1111

1212
```js
13-
/*eslint node/no-callback-literal: "error" */
13+
/*eslint n/no-callback-literal: "error" */
1414

1515
cb('this is an error string');
1616
cb({ a: 1 });
@@ -20,7 +20,7 @@ callback(0);
2020
Examples of :+1: **correct** code for this rule:
2121

2222
```js
23-
/*eslint node/no-callback-literal: "error" */
23+
/*eslint n/no-callback-literal: "error" */
2424

2525
cb(undefined);
2626
cb(null, 5);
@@ -33,7 +33,7 @@ callback(someVariable);
3333
```json
3434
{
3535
"rules": {
36-
"node/no-callback-literal": "error"
36+
"n/no-callback-literal": "error"
3737
}
3838
}
3939
```

docs/rules/no-deprecated-api.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# node/no-deprecated-api
1+
# n/no-deprecated-api
22
> disallow deprecated APIs
3-
> - ⭐️ This rule is included in `plugin:node/recommended` preset.
3+
> - ⭐️ This rule is included in `plugin:n/recommended` preset.
44
55
Node has many deprecated API.
66
The community is going to remove those API from Node in future, so we should not use those.
@@ -10,7 +10,7 @@ The community is going to remove those API from Node in future, so we should not
1010
Examples of :-1: **incorrect** code for this rule:
1111

1212
```js
13-
/*eslint node/no-deprecated-api: "error" */
13+
/*eslint n/no-deprecated-api: "error" */
1414

1515
var fs = require("fs");
1616
fs.exists("./foo.js", function() {}); /*ERROR: 'fs.exists' was deprecated since v4. Use 'fs.stat()' or 'fs.access()' instead.*/
@@ -163,7 +163,7 @@ This rule has 3 options.
163163
```json
164164
{
165165
"rules": {
166-
"node/no-deprecated-api": ["error", {
166+
"n/no-deprecated-api": ["error", {
167167
"version": ">=8.0.0",
168168
"ignoreModuleItems": [],
169169
"ignoreGlobalItems": []
@@ -272,7 +272,7 @@ This option can include the following values:
272272
Examples of :+1: **correct** code for the `{"ignoreModuleItems": ["new buffer.Buffer()"]}`:
273273

274274
```js
275-
/*eslint node/no-deprecated-api: [error, {ignoreModuleItems: ["new buffer.Buffer()"]}] */
275+
/*eslint n/no-deprecated-api: [error, {ignoreModuleItems: ["new buffer.Buffer()"]}] */
276276

277277
const buffer = require("buffer")
278278
const data = new buffer.Buffer(10) // OK since it's in ignoreModuleItems.
@@ -304,7 +304,7 @@ This option can include the following values:
304304
Examples of :+1: **correct** code for the `{"ignoreGlobalItems": ["new Buffer()"]}`:
305305

306306
```js
307-
/*eslint node/no-deprecated-api: [error, {ignoreGlobalItems: ["new Buffer()"]}] */
307+
/*eslint n/no-deprecated-api: [error, {ignoreGlobalItems: ["new Buffer()"]}] */
308308

309309
const data = new Buffer(10) // OK since it's in ignoreGlobalItems.
310310
```

docs/rules/no-exports-assign.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# node/no-exports-assign
1+
# n/no-exports-assign
22
> disallow the assignment to `exports`
3-
> - ⭐️ This rule is included in `plugin:node/recommended` preset.
3+
> - ⭐️ This rule is included in `plugin:n/recommended` preset.
44
55
To assign to `exports` variable would not work as expected.
66

@@ -14,12 +14,12 @@ exports = {
1414

1515
## 📖 Rule Details
1616

17-
This rule is aimed at disallowing `exports = {}`, but allows `module.exports = exports = {}` to avoid conflict with [node/exports-style](./exports-style.md) rule's `allowBatchAssign` option.
17+
This rule is aimed at disallowing `exports = {}`, but allows `module.exports = exports = {}` to avoid conflict with [n/exports-style](./exports-style.md) rule's `allowBatchAssign` option.
1818

1919
👍 Examples of **correct** code for this rule:
2020

2121
```js
22-
/*eslint node/no-exports-assign: error */
22+
/*eslint n/no-exports-assign: error */
2323

2424
module.exports.foo = 1
2525
exports.bar = 2
@@ -34,7 +34,7 @@ exports = module.exports = {}
3434
👎 Examples of **incorrect** code for this rule:
3535

3636
```js
37-
/*eslint node/no-exports-assign: error */
37+
/*eslint n/no-exports-assign: error */
3838

3939
exports = {}
4040
```

docs/rules/no-extraneous-import.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# node/no-extraneous-import
1+
# n/no-extraneous-import
22
> disallow `import` declarations which import extraneous modules
3-
> - ⭐️ This rule is included in `plugin:node/recommended` preset.
3+
> - ⭐️ This rule is included in `plugin:n/recommended` preset.
44
55
If an `import` declaration's source is extraneous (it's not written in `package.json`), the program works in local, but will not work after dependencies are re-installed. It will cause troubles to your team/contributors.
66
This rule disallows `import` declarations of extraneous modules.
@@ -14,7 +14,7 @@ This rule warns `import` declarations of extraneous modules.
1414
```json
1515
{
1616
"rules": {
17-
"node/no-extraneous-import": ["error", {
17+
"n/no-extraneous-import": ["error", {
1818
"allowModules": [],
1919
"resolvePaths": [],
2020
"tryExtensions": []
@@ -34,7 +34,7 @@ This option is an array of strings as module names.
3434
```json
3535
{
3636
"rules": {
37-
"node/no-extraneous-import": ["error", {
37+
"n/no-extraneous-import": ["error", {
3838
"allowModules": ["electron"]
3939
}]
4040
}
@@ -75,7 +75,7 @@ module.exports = {
7575
}
7676
},
7777
"rules": {
78-
"node/no-extraneous-import": "error"
78+
"n/no-extraneous-import": "error"
7979
}
8080
}
8181
```

0 commit comments

Comments
 (0)