From 238f97473a6bfd585a6976f3a2606750ee42f769 Mon Sep 17 00:00:00 2001 From: bendtherules Date: Mon, 20 Aug 2018 12:51:18 +0530 Subject: [PATCH] Update readme usage + Export config with plugin value already set --- README.md | 32 ++++++++++++++++---------------- lib/index.js | 2 ++ 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 790825e..4e646b0 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,22 @@ $ npm install eslint-plugin-undef-init --save-dev ## 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: ```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. ```js diff --git a/lib/index.js b/lib/index.js index 76f3278..2eab9a3 100644 --- a/lib/index.js +++ b/lib/index.js @@ -20,6 +20,8 @@ module.exports.rules = requireIndex(__dirname + "/rules"); module.exports.configs = { recommended: { + plugins: ['undef-init'], + rules: { // Disable no-undef-init as its the opposite inbuilt rule 'no-undef-init': 0,