From 999175b6b63c8b332d002923eb59039e7242ea1f Mon Sep 17 00:00:00 2001 From: Tejesh Mehta Date: Sun, 18 Feb 2018 13:56:07 -0800 Subject: [PATCH] Add recommended config and update docs --- README.md | 16 +++++++++++++++- lib/index.js | 15 +++++++++++---- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2145086..d001379 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,21 @@ $ npm install eslint-plugin-flow-header --save-dev ## Usage -Add `flow-header` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix: +### Recommended configuration + +Add `flow-header` to your `.eslintrc` configuration file by extending the `recommended` configuration. The recommended config just adds the `flow-header` rule to your configuration. + +```json +{ + "extends": [ + "plugin:flow-header/recommended" + ] +} +``` + +### Add Eslint Rule + +You can also add the rule manually by using flow-header as a plugin. Add `flow-header` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix: ```json { diff --git a/lib/index.js b/lib/index.js index 3c4aa22..d7587e6 100644 --- a/lib/index.js +++ b/lib/index.js @@ -16,7 +16,14 @@ var requireIndex = require("requireindex"); // import all rules in lib/rules -module.exports.rules = requireIndex(__dirname + "/rules"); - - - +module.exports = { + configs: { + recommended: { + plugins: ["flow-header"], + rules: { + "flow-header/flow-header": 2 + } + } + }, + rules: requireIndex(__dirname + "/rules") +}