Skip to content

Commit

Permalink
📝 fix rule names in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticatea committed Mar 28, 2020
1 parent e2da592 commit 7dc8f80
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 37 deletions.
6 changes: 3 additions & 3 deletions docs/rules/callback-return.md
Expand Up @@ -32,7 +32,7 @@ The rule takes a single option - an array of possible callback names - which may
Examples of **incorrect** code for this rule with the default `["callback", "cb", "next"]` option:

```js
/*eslint callback-return: "error"*/
/*eslint node/callback-return: "error"*/

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

```js
/*eslint callback-return: "error"*/
/*eslint node/callback-return: "error"*/

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

```js
/*eslint callback-return: ["error", ["done", "send.error", "send.success"]]*/
/*eslint node/callback-return: ["error", ["done", "send.error", "send.success"]]*/

function foo(err, done) {
if (err) {
Expand Down
4 changes: 2 additions & 2 deletions docs/rules/global-require.md
Expand Up @@ -29,7 +29,7 @@ This rule requires all calls to `require()` to be at the top level of the module
Examples of **incorrect** code for this rule:

```js
/*eslint global-require: "error"*/
/*eslint node/global-require: "error"*/
/*eslint-env es6*/

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

```js
/*eslint global-require: "error"*/
/*eslint node/global-require: "error"*/

// all these variations of require() are ok
require('x');
Expand Down
1 change: 0 additions & 1 deletion docs/rules/handle-callback-err.md
Expand Up @@ -71,7 +71,6 @@ If the configured name of the error variable begins with a `^` it is considered
* If the option is `"^.+Error$"`, the rule reports unhandled errors where the parameter name ends with `Error` (for example, `connectionError` or `validationError` will match).
* If the option is `"^.*(e|E)rr"`, the rule reports unhandled errors where the parameter name matches any string that contains `err` or `Err` (for example, `err`, `error`, `anyError`, `some_err` will match).


## 🔎 Implementation

- [Rule source](../../lib/rules/handle-callback-err.js)
Expand Down
10 changes: 5 additions & 5 deletions docs/rules/no-mixed-requires.md
Expand Up @@ -39,7 +39,7 @@ Configuring this rule with one boolean option `true` is deprecated.
Examples of **incorrect** code for this rule with the default `{ "grouping": false, "allowCall": false }` options:

```js
/*eslint no-mixed-requires: "error"*/
/*eslint node/no-mixed-requires: "error"*/

var fs = require('fs'),
i = 0;
Expand All @@ -52,7 +52,7 @@ var async = require('async'),
Examples of **correct** code for this rule with the default `{ "grouping": false, "allowCall": false }` options:

```js
/*eslint no-mixed-requires: "error"*/
/*eslint node/no-mixed-requires: "error"*/

// only require declarations (grouping off)
var eventEmitter = require('events').EventEmitter,
Expand All @@ -75,7 +75,7 @@ var foo = require('foo' + VERSION),
Examples of **incorrect** code for this rule with the `{ "grouping": true }` option:

```js
/*eslint no-mixed-requires: ["error", { "grouping": true }]*/
/*eslint node/no-mixed-requires: ["error", { "grouping": true }]*/

// invalid because of mixed types "core" and "module"
var fs = require('fs'),
Expand All @@ -91,7 +91,7 @@ var foo = require('foo'),
Examples of **incorrect** code for this rule with the `{ "allowCall": true }` option:

```js
/*eslint no-mixed-requires: ["error", { "allowCall": true }]*/
/*eslint node/no-mixed-requires: ["error", { "allowCall": true }]*/

var async = require('async'),
debug = require('diagnostics').someFunction('my-module'), /* allowCall doesn't allow calling any function */
Expand All @@ -101,7 +101,7 @@ var async = require('async'),
Examples of **correct** code for this rule with the `{ "allowCall": true }` option:

```js
/*eslint no-mixed-requires: ["error", { "allowCall": true }]*/
/*eslint node/no-mixed-requires: ["error", { "allowCall": true }]*/

var async = require('async'),
debug = require('diagnostics')('my-module'),
Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-new-require.md
Expand Up @@ -28,15 +28,15 @@ This rule aims to eliminate use of the `new require` expression.
Examples of **incorrect** code for this rule:

```js
/*eslint no-new-require: "error"*/
/*eslint node/no-new-require: "error"*/

var appHeader = new require('app-header');
```

Examples of **correct** code for this rule:

```js
/*eslint no-new-require: "error"*/
/*eslint node/no-new-require: "error"*/

var AppHeader = require('app-header');
var appHeader = new AppHeader();
Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-process-env.md
Expand Up @@ -10,7 +10,7 @@ This rule is aimed at discouraging use of `process.env` to avoid global dependen
Examples of **incorrect** code for this rule:

```js
/*eslint no-process-env: "error"*/
/*eslint node/no-process-env: "error"*/

if(process.env.NODE_ENV === "development") {
//...
Expand All @@ -20,7 +20,7 @@ if(process.env.NODE_ENV === "development") {
Examples of **correct** code for this rule:

```js
/*eslint no-process-env: "error"*/
/*eslint node/no-process-env: "error"*/

var config = require("./config");

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-process-exit.md
Expand Up @@ -29,7 +29,7 @@ This rule aims to prevent the use of `process.exit()` in Node.js JavaScript. As
Examples of **incorrect** code for this rule:

```js
/*eslint no-process-exit: "error"*/
/*eslint node/no-process-exit: "error"*/

process.exit(1);
process.exit(0);
Expand All @@ -38,7 +38,7 @@ process.exit(0);
Examples of **correct** code for this rule:

```js
/*eslint no-process-exit: "error"*/
/*eslint node/no-process-exit: "error"*/

Process.exit();
var exit = process.exit;
Expand Down
16 changes: 8 additions & 8 deletions docs/rules/no-restricted-import.md
Expand Up @@ -11,7 +11,7 @@ The rule takes an array as options: the names of restricted modules.

```json
{
"no-restricted-import": ["error", [
"node/no-restricted-import": ["error", [
"foo-module",
"bar-module"
]]
Expand All @@ -22,7 +22,7 @@ You may also specify a custom message for each module you want to restrict as fo

```json
{
"no-restricted-import": ["error", [
"node/no-restricted-import": ["error", [
{
"name": "foo-module",
"message": "Please use foo-module2 instead."
Expand All @@ -39,7 +39,7 @@ And you can use glob patterns in the `name` property.

```json
{
"no-restricted-import": ["error", [
"node/no-restricted-import": ["error", [
{
"name": "lodash/*",
"message": "Please use xyz-module instead."
Expand All @@ -60,7 +60,7 @@ module.exports = {
{
files: "client/**",
rules: {
"no-restricted-import": ["error", [
"node/no-restricted-import": ["error", [
{
name: path.resolve(__dirname, "server/**"),
message: "Don't use server code from client code."
Expand All @@ -71,7 +71,7 @@ module.exports = {
{
files: "server/**",
rules: {
"no-restricted-import": ["error", [
"node/no-restricted-import": ["error", [
{
name: path.resolve(__dirname, "client/**"),
message: "Don't use client code from server code."
Expand All @@ -88,7 +88,7 @@ module.exports = {
Examples of **incorrect** code for this rule with sample `"fs", "cluster", "lodash"` restricted modules:

```js
/*eslint no-restricted-import: ["error", ["fs", "cluster", "lodash/*"]]*/
/*eslint node/no-restricted-import: ["error", ["fs", "cluster", "lodash/*"]]*/

import fs from 'fs';
import cluster from 'cluster';
Expand All @@ -98,14 +98,14 @@ import pick from 'lodash/pick';
Examples of **correct** code for this rule with sample `"fs", "cluster", "lodash"` restricted modules:

```js
/*eslint no-restricted-import: ["error", ["fs", "cluster", "lodash/*"]]*/
/*eslint node/no-restricted-import: ["error", ["fs", "cluster", "lodash/*"]]*/

import crypto from 'crypto';
import _ from 'lodash';
```

```js
/*eslint no-restricted-import: ["error", ["fs", "cluster", { "name": ["lodash/*", "!lodash/pick"] }]]*/
/*eslint node/no-restricted-import: ["error", ["fs", "cluster", { "name": ["lodash/*", "!lodash/pick"] }]]*/

import pick from 'lodash/pick';
```
Expand Down
16 changes: 8 additions & 8 deletions docs/rules/no-restricted-require.md
Expand Up @@ -18,7 +18,7 @@ The rule takes an array as options: the names of restricted modules.

```json
{
"no-restricted-require": ["error", [
"node/no-restricted-require": ["error", [
"foo-module",
"bar-module"
]]
Expand All @@ -29,7 +29,7 @@ You may also specify a custom message for each module you want to restrict as fo

```json
{
"no-restricted-require": ["error", [
"node/no-restricted-require": ["error", [
{
"name": "foo-module",
"message": "Please use foo-module2 instead."
Expand All @@ -46,7 +46,7 @@ And you can use glob patterns in the `name` property.

```json
{
"no-restricted-require": ["error", [
"node/no-restricted-require": ["error", [
{
"name": "lodash/*",
"message": "Please use xyz-module instead."
Expand All @@ -67,7 +67,7 @@ module.exports = {
{
files: "client/**",
rules: {
"no-restricted-require": ["error", [
"node/no-restricted-require": ["error", [
{
name: path.resolve(__dirname, "server/**"),
message: "Don't use server code from client code."
Expand All @@ -78,7 +78,7 @@ module.exports = {
{
files: "server/**",
rules: {
"no-restricted-require": ["error", [
"node/no-restricted-require": ["error", [
{
name: path.resolve(__dirname, "client/**"),
message: "Don't use client code from server code."
Expand All @@ -95,7 +95,7 @@ module.exports = {
Examples of **incorrect** code for this rule with sample `"fs", "cluster", "lodash"` restricted modules:

```js
/*eslint no-restricted-require: ["error", ["fs", "cluster", "lodash/*"]]*/
/*eslint node/no-restricted-require: ["error", ["fs", "cluster", "lodash/*"]]*/

const fs = require('fs');
const cluster = require('cluster');
Expand All @@ -105,14 +105,14 @@ const pick = require('lodash/pick');
Examples of **correct** code for this rule with sample `"fs", "cluster", "lodash"` restricted modules:

```js
/*eslint no-restricted-require: ["error", ["fs", "cluster", "lodash/*"]]*/
/*eslint node/no-restricted-require: ["error", ["fs", "cluster", "lodash/*"]]*/

const crypto = require('crypto');
const _ = require('lodash');
```

```js
/*eslint no-restricted-require: ["error", ["fs", "cluster", { "name": ["lodash/*", "!lodash/pick"] }]]*/
/*eslint node/no-restricted-require: ["error", ["fs", "cluster", { "name": ["lodash/*", "!lodash/pick"] }]]*/

const pick = require('lodash/pick');
```
Expand Down
8 changes: 4 additions & 4 deletions docs/rules/no-sync.md
Expand Up @@ -14,7 +14,7 @@ This rule has an optional object option `{ allowAtRootLevel: <boolean> }`, which
Examples of **incorrect** code for this rule with the default `{ allowAtRootLevel: false }` option:

```js
/*eslint no-sync: "error"*/
/*eslint node/no-sync: "error"*/

fs.existsSync(somePath);

Expand All @@ -26,7 +26,7 @@ function foo() {
Examples of **correct** code for this rule with the default `{ allowAtRootLevel: false }` option:

```js
/*eslint no-sync: "error"*/
/*eslint node/no-sync: "error"*/

obj.sync();

Expand All @@ -38,7 +38,7 @@ async(function() {
Examples of **incorrect** code for this rule with the `{ allowAtRootLevel: true }` option

```js
/*eslint no-sync: ["error", { allowAtRootLevel: true }]*/
/*eslint node/no-sync: ["error", { allowAtRootLevel: true }]*/

function foo() {
var contents = fs.readFileSync(somePath).toString();
Expand All @@ -50,7 +50,7 @@ var bar = baz => fs.readFileSync(qux);
Examples of **correct** code for this rule with the `{ allowAtRootLevel: true }` option

```js
/*eslint no-sync: ["error", { allowAtRootLevel: true }]*/
/*eslint node/no-sync: ["error", { allowAtRootLevel: true }]*/

fs.readFileSync(somePath).toString();
```
Expand Down

0 comments on commit 7dc8f80

Please sign in to comment.