diff --git a/docs/rules/exports-style.md b/docs/rules/exports-style.md index c3ef0a56..682fd36c 100644 --- a/docs/rules/exports-style.md +++ b/docs/rules/exports-style.md @@ -23,7 +23,7 @@ If you use `exports`, this rule disallows `module.exports`. You can select it by an option. -## Options +### Options This rule has a string option. @@ -43,7 +43,7 @@ This rule has a string option. - `"exports"` requires `exports` and disallows `module.exports`. - `allowBatchAssign` (default is `false`) allows `module.exports = exports = obj` if this is `true`. -### module.exports +#### module.exports Examples of :-1: **incorrect** code for the `"module.exports"` option: @@ -67,7 +67,7 @@ module.exports = { module.exports.baz = 3 ``` -### exports +#### exports Examples of :-1: **incorrect** code for the `"exports"` option: @@ -91,7 +91,7 @@ exports.foo = 1 exports.bar = 2 ``` -### allowBatchAssign +#### allowBatchAssign Examples of :+1: **correct** code for the `"exports"` and `{"allowBatchAssign": true}` option: diff --git a/docs/rules/file-extension-in-import.md b/docs/rules/file-extension-in-import.md index cf17569f..86185420 100644 --- a/docs/rules/file-extension-in-import.md +++ b/docs/rules/file-extension-in-import.md @@ -18,7 +18,7 @@ Also, we can import a variety kind of files with bundlers such as Webpack. In th This rule enforces the style of file extensions in `import`/`export` declarations. -## Options +### Options This rule has a string option and an object option. @@ -40,7 +40,7 @@ This rule has a string option and an object option. - `tryExtensions` is the file extensions to resolve import paths. Default is `[".js", ".json", ".node"]`. - `.xxx` is the overriding setting for specific file extensions. You can use arbitrary property names which start with `.`. -### always +#### always Examples of :-1: **incorrect** code for the `"always"` option: @@ -59,7 +59,7 @@ import eslint from "eslint" import foo from "./path/to/a/file.js" ``` -### never +#### never Examples of :-1: **incorrect** code for the `"never"` option: @@ -78,7 +78,7 @@ import eslint from "eslint" import foo from "./path/to/a/file" ``` -### .xxx +#### .xxx Examples of :+1: **correct** code for the `["always", { ".js": "never" }]` option: @@ -91,7 +91,7 @@ import styles from "./styles.css" import logo from "./logo.png" ``` -## Shared Settings +### Shared Settings The following options can be set by [shared settings](http://eslint.org/docs/user-guide/configuring.html#adding-shared-settings). Several rules have the same option, but we can set this option at once. diff --git a/docs/rules/no-deprecated-api.md b/docs/rules/no-deprecated-api.md index 73db41ec..dc1933df 100644 --- a/docs/rules/no-deprecated-api.md +++ b/docs/rules/no-deprecated-api.md @@ -144,7 +144,7 @@ This rule reports the following deprecated API. > For example, `require("punycode")` still imports the deprecated core module even if you executed `npm install punycode`. > Use `require("punycode/")` to import userland modules rather than core modules. -## Options +### Options This rule has 2 options. @@ -159,7 +159,7 @@ This rule has 2 options. } ``` -### ignoreModuleItems +#### ignoreModuleItems This is the array of module names and module's member names. Default is an empty array. @@ -262,7 +262,7 @@ const buffer = require("buffer") const data = new buffer.Buffer(10) // OK since it's in ignoreModuleItems. ``` -### ignoreGlobalItems +#### ignoreGlobalItems This is the array of global variable names and global variable's member names. Default is an empty array. @@ -293,7 +293,7 @@ Examples of :+1: **correct** code for the `{"ignoreGlobalItems": ["new Buffer()" const data = new Buffer(10) // OK since it's in ignoreGlobalItems. ``` -## Known Limitations +## ⚠️ Known Limitations This rule cannot report the following cases: diff --git a/docs/rules/no-extraneous-import.md b/docs/rules/no-extraneous-import.md index 81c68730..0de56f42 100644 --- a/docs/rules/no-extraneous-import.md +++ b/docs/rules/no-extraneous-import.md @@ -8,7 +8,7 @@ This rule disallows `import` declarations of extraneous modules. This rule warns `import` declarations of extraneous modules. -## Options +### Options ```json { @@ -22,7 +22,7 @@ This rule warns `import` declarations of extraneous modules. } ``` -### allowModules +#### allowModules Some platforms have additional embedded modules. For example, Electron has `electron` module. @@ -40,21 +40,21 @@ This option is an array of strings as module names. } ``` -### resolvePaths +#### resolvePaths Adds additional paths to try for when resolving imports. If a path is relative, it will be resolved from CWD. Default is `[]` -### tryExtensions +#### tryExtensions When an import path does not exist, this rule checks whether or not any of `path.js`, `path.json`, and `path.node` exists. `tryExtensions` option is the extension list this rule uses at the time. Default is `[".js", ".json", ".node"]`. -## Shared Settings +### Shared Settings The following options can be set by [shared settings](http://eslint.org/docs/user-guide/configuring.html#adding-shared-settings). Several rules have the same option, but we can set this option at once. diff --git a/docs/rules/no-extraneous-require.md b/docs/rules/no-extraneous-require.md index 45ae8531..ad4d6413 100644 --- a/docs/rules/no-extraneous-require.md +++ b/docs/rules/no-extraneous-require.md @@ -10,7 +10,7 @@ This rule disallows `require()` of extraneous modules. This rule warns `require()` of extraneous modules. -## Options +### Options ```json { @@ -24,7 +24,7 @@ This rule warns `require()` of extraneous modules. } ``` -### allowModules +#### allowModules Some platforms have additional embedded modules. For example, Electron has `electron` module. @@ -42,21 +42,21 @@ This option is an array of strings as module names. } ``` -### resolvePaths +#### resolvePaths Adds additional paths to try for when resolving imports. If a path is relative, it will be resolved from CWD. Default is `[]` -### tryExtensions +#### tryExtensions When an import path does not exist, this rule checks whether or not any of `path.js`, `path.json`, and `path.node` exists. `tryExtensions` option is the extension list this rule uses at the time. Default is `[".js", ".json", ".node"]`. -## Shared Settings +### Shared Settings The following options can be set by [shared settings](http://eslint.org/docs/user-guide/configuring.html#adding-shared-settings). Several rules have the same option, but we can set this option at once. diff --git a/docs/rules/no-hide-core-modules.md b/docs/rules/no-hide-core-modules.md index c52cc023..53ac4c3d 100644 --- a/docs/rules/no-hide-core-modules.md +++ b/docs/rules/no-hide-core-modules.md @@ -32,7 +32,7 @@ const util = require("util") // OK if this is the core module 'util' surely. const path = require("path") // OK if this is the core module 'path' surely. ``` -## Options +### Options ```json { @@ -44,19 +44,19 @@ const path = require("path") // OK if this is the core module 'path' surely. } ``` -### allow +#### allow If you are sure that your module depends on the third-party module which has the same name as a core module, you can allow it by `allow` option. E.g. `{"allow": ["util", "path"]}`. Default is en empty array. -### ignoreDirectDependencies +#### ignoreDirectDependencies If `ignoreDirectDependencies: true`, if the third-party module which has the same name as a core module exists in your `package.json`, this rule ignores it. This option would allow all explicit dependencies which are hiding core modules. -### ignoreIndirectDependencies +#### ignoreIndirectDependencies If `ignoreIndirectDependencies: true`, if the third-party module which has the same name as a core module does not exist in your `package.json`, this rule ignores it. diff --git a/docs/rules/no-missing-import.md b/docs/rules/no-missing-import.md index 303c2556..d3a2ad8c 100644 --- a/docs/rules/no-missing-import.md +++ b/docs/rules/no-missing-import.md @@ -28,7 +28,7 @@ import existingFile from "./existing-file"; import existingModule from "existing-module"; ``` -## Options +### Options ```json { @@ -42,7 +42,7 @@ import existingModule from "existing-module"; } ``` -### allowModules +#### allowModules Some platforms have additional embedded modules. For example, Electron has `electron` module. @@ -60,21 +60,21 @@ This option is an array of strings as module names. } ``` -### resolvePaths +#### resolvePaths Adds additional paths to try for when resolving imports. If a path is relative, it will be resolved from CWD. Default is `[]` -### tryExtensions +#### tryExtensions When an import path does not exist, this rule checks whether or not any of `path.js`, `path.json`, and `path.node` exists. `tryExtensions` option is the extension list this rule uses at the time. Default is `[".js", ".json", ".node"]`. -## Shared Settings +### Shared Settings The following options can be set by [shared settings](http://eslint.org/docs/user-guide/configuring.html#adding-shared-settings). Several rules have the same option, but we can set this option at once. diff --git a/docs/rules/no-missing-require.md b/docs/rules/no-missing-require.md index 31ca965d..e0d3d86b 100644 --- a/docs/rules/no-missing-require.md +++ b/docs/rules/no-missing-require.md @@ -35,7 +35,7 @@ var existingModule = require("existing-module"); var foo = require(FOO_NAME); ``` -## Options +### Options ```json { @@ -49,7 +49,7 @@ var foo = require(FOO_NAME); } ``` -### allowModules +#### allowModules Some platforms have additional embedded modules. For example, Electron has `electron` module. @@ -67,21 +67,21 @@ This option is an array of strings as module names. } ``` -### resolvePaths +#### resolvePaths Adds additional paths to try for when resolving a require. If a path is relative, it will be resolved from CWD. Default is `[]` -### tryExtensions +#### tryExtensions When an import path does not exist, this rule checks whether or not any of `path.js`, `path.json`, and `path.node` exists. `tryExtensions` option is the extension list this rule uses at the time. Default is `[".js", ".json", ".node"]`. -## Shared Settings +### Shared Settings The following options can be set by [shared settings](http://eslint.org/docs/user-guide/configuring.html#adding-shared-settings). Several rules have the same option, but we can set this option at once. diff --git a/docs/rules/no-unpublished-bin.md b/docs/rules/no-unpublished-bin.md index ae2f582d..d121d608 100644 --- a/docs/rules/no-unpublished-bin.md +++ b/docs/rules/no-unpublished-bin.md @@ -21,7 +21,7 @@ If `npm` ignores the files in `bin` field, this rule warns the files. - If `files` field does not includes the files in `bin` field. - If `.npmignore` file includes the files in `bin` field. -## Options +### Options ```json { @@ -33,7 +33,7 @@ If `npm` ignores the files in `bin` field, this rule warns the files. } ``` -### convertPath +#### convertPath If we use transpilers (e.g. Babel), perhaps the file path to a source code is never published. `convertPath` option tells to the rule, it needs to convert file paths. @@ -87,7 +87,7 @@ In this style, this option has the following shape as the same expression as abo In addition, we can specify glob patterns to exclude files. -## Shared Settings +### Shared Settings The following options can be set by [shared settings](http://eslint.org/docs/user-guide/configuring.html#adding-shared-settings). Several rules have the same option, but we can set this option at once. diff --git a/docs/rules/no-unpublished-import.md b/docs/rules/no-unpublished-import.md index 44cd8064..2c80cb81 100644 --- a/docs/rules/no-unpublished-import.md +++ b/docs/rules/no-unpublished-import.md @@ -17,7 +17,7 @@ Then this rule warns `import` declarations in \*published\* files if the `import > This intends to prevent "Module Not Found" error after `npm publish`.
> :bulb: If you want to import `devDependencies`, please write `.npmignore` or `"files"` field of `package.json`. -## Options +### Options ```json { @@ -31,7 +31,7 @@ Then this rule warns `import` declarations in \*published\* files if the `import } ``` -### allowModules +#### allowModules Some platforms have additional embedded modules. For example, Electron has `electron` module. @@ -49,7 +49,7 @@ This option is an array of strings as module names. } ``` -### convertPath +#### convertPath If we use transpilers (e.g. Babel), perhaps the file path to a source code is never published. `convertPath` option tells to the rule, it needs to convert file paths. @@ -103,14 +103,14 @@ For example: In this style, this option has the following shape as the same expression as above: `{include: [], replace: [, ]}`. In addition, we can specify glob patterns to exclude files. -### tryExtensions +#### tryExtensions When an import path does not exist, this rule checks whether or not any of `path.js`, `path.json`, and `path.node` exists. `tryExtensions` option is the extension list this rule uses at the time. Default is `[".js", ".json", ".node"]`. -## Shared Settings +### Shared Settings The following options can be set by [shared settings](http://eslint.org/docs/user-guide/configuring.html#adding-shared-settings). Several rules have the same option, but we can set this option at once. diff --git a/docs/rules/no-unpublished-require.md b/docs/rules/no-unpublished-require.md index 99906455..e7a6a438 100644 --- a/docs/rules/no-unpublished-require.md +++ b/docs/rules/no-unpublished-require.md @@ -18,7 +18,7 @@ Then this rule warns `require()` expressions in \*published\* files if the `requ > This intends to prevent "Module Not Found" error after `npm publish`.
> :bulb: If you want to import `devDependencies`, please write `.npmignore` or `"files"` field of `package.json`. -## Options +### Options ```json { @@ -32,7 +32,7 @@ Then this rule warns `require()` expressions in \*published\* files if the `requ } ``` -### allowModules +#### allowModules Some platforms have additional embedded modules. For example, Electron has `electron` module. @@ -50,7 +50,7 @@ This option is an array of strings as module names. } ``` -### convertPath +#### convertPath If we use transpilers (e.g. Babel), perhaps the file path to a source code is never published. `convertPath` option tells to the rule, it needs to convert file paths. @@ -104,14 +104,14 @@ For example: In this style, this option has the following shape as the same expression as above: `{include: [], replace: [, ]}`. In addition, we can specify glob patterns to exclude files. -### tryExtensions +#### tryExtensions When an import path does not exist, this rule checks whether or not any of `path.js`, `path.json`, and `path.node` exists. `tryExtensions` option is the extension list this rule uses at the time. Default is `[".js", ".json", ".node"]`. -## Shared Settings +### Shared Settings The following options can be set by [shared settings](http://eslint.org/docs/user-guide/configuring.html#adding-shared-settings). Several rules have the same option, but we can set this option at once. diff --git a/docs/rules/no-unsupported-features.md b/docs/rules/no-unsupported-features.md index 4aa86cab..87df20f3 100644 --- a/docs/rules/no-unsupported-features.md +++ b/docs/rules/no-unsupported-features.md @@ -108,7 +108,7 @@ var p = new Promise((resolve, reject) => { }); ``` -## Options +### Options ```json { @@ -119,7 +119,7 @@ var p = new Promise((resolve, reject) => { } ``` -### version +#### version As mentioned above, this rule reads the [engines] field of `package.json` to detect Node.js version. Also, you can overwrite the version by `version` option. @@ -138,7 +138,7 @@ The `version` option accepts the following version number: - `9.0` ... Illegal escape sequences in taggled templates, RegExp 's' flags, RegExp lookbehind assertions, `SharedArrayBuffer`, and `Atomics`. - `10.0` ... RegExp named capture groups, RegExp Unicode property escapes, Async generators, and `for-await-of` loops. -### ignores +#### ignores If you are using transpilers, maybe you want to ignore the warnings about some features. You can use this `ignores` option to ignore the given features. @@ -292,12 +292,12 @@ function foo(a = 1) { } ``` -## Known Limitations +## ⚠️ Known Limitations This rule cannot report non-static things. E.g., a use of instance methods. -## Further Reading +## 📚 Further Reading - http://node.green/ diff --git a/docs/rules/process-exit-as-throw.md b/docs/rules/process-exit-as-throw.md index e368e4a0..595b337b 100644 --- a/docs/rules/process-exit-as-throw.md +++ b/docs/rules/process-exit-as-throw.md @@ -21,7 +21,7 @@ If you turn this rule on, ESLint comes to address `process.exit()` as throw in c This rule itself never warn code. -## Related Rules +## 📚 Related Rules - [consistent-return] - [no-fallthrough] diff --git a/docs/rules/shebang.md b/docs/rules/shebang.md index 6c460787..1c0b9d30 100644 --- a/docs/rules/shebang.md +++ b/docs/rules/shebang.md @@ -57,7 +57,7 @@ The following patterns are not considered problems for other files: console.log("hello"); ``` -## Options +### Options ```json { @@ -65,7 +65,7 @@ console.log("hello"); } ``` -### convertPath +#### convertPath If we use transpilers (e.g. Babel), perhaps the file path to a source code is never handled as a bin file. `convertPath` option tells to the rule, it needs to convert file paths. @@ -118,7 +118,7 @@ For example: In this style, this option has the following shape as the same expression as above: `{include: [], replace: [, ]}`. In addition, we can specify glob patterns to exclude files. -## Shared Settings +### Shared Settings The following options can be set by [shared settings](http://eslint.org/docs/user-guide/configuring.html#adding-shared-settings). Several rules have the same option, but we can set this option at once.