Update readme usage + Export config with plugin value already set

This commit is contained in:
2018-08-20 12:51:18 +05:30
parent 6d53234a9c
commit 238f97473a
2 changed files with 18 additions and 16 deletions
+16 -16
View File
@@ -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
+2
View File
@@ -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,