mirror of
https://github.com/bendtherules/eslint-plugin-undef-init.git
synced 2026-08-18 13:52:15 +00:00
Update readme usage + Export config with plugin value already set
This commit is contained in:
@@ -20,6 +20,22 @@ $ npm install eslint-plugin-undef-init --save-dev
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
Either extend from the plugin or add the rules explicitly.
|
||||||
|
|
||||||
|
### A. Extend from plugin
|
||||||
|
```js
|
||||||
|
{
|
||||||
|
"extends": [
|
||||||
|
// ... other extends here (like airbnb)
|
||||||
|
"plugin:undef-init/recommended"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## OR
|
||||||
|
|
||||||
|
### B. Use rule directly
|
||||||
|
|
||||||
Add `undef-init` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:
|
Add `undef-init` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
@@ -30,22 +46,6 @@ Add `undef-init` to the plugins section of your `.eslintrc` configuration file.
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, either extend from the plugin or add the rules explicitly.
|
|
||||||
|
|
||||||
### A. Extend from plugin
|
|
||||||
```js
|
|
||||||
{
|
|
||||||
"extends": [
|
|
||||||
// ... other extends here (like airbnb)
|
|
||||||
"undef-init"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## OR
|
|
||||||
|
|
||||||
### B. Use rule directly
|
|
||||||
|
|
||||||
Then configure the rules you want to use under the rules section.
|
Then configure the rules you want to use under the rules section.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ module.exports.rules = requireIndex(__dirname + "/rules");
|
|||||||
|
|
||||||
module.exports.configs = {
|
module.exports.configs = {
|
||||||
recommended: {
|
recommended: {
|
||||||
|
plugins: ['undef-init'],
|
||||||
|
|
||||||
rules: {
|
rules: {
|
||||||
// Disable no-undef-init as its the opposite inbuilt rule
|
// Disable no-undef-init as its the opposite inbuilt rule
|
||||||
'no-undef-init': 0,
|
'no-undef-init': 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user