From 1c8e9d362864302a8c32046544f3b81210d1933b Mon Sep 17 00:00:00 2001 From: Ilya Azin Date: Tue, 17 Nov 2020 13:33:19 +0300 Subject: [PATCH] docs: extend new-rule doc --- docs/new-rule.md | 59 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 46 insertions(+), 13 deletions(-) diff --git a/docs/new-rule.md b/docs/new-rule.md index cefec44..cc6725f 100644 --- a/docs/new-rule.md +++ b/docs/new-rule.md @@ -1,23 +1,56 @@ -## New rule +# Creating a new rule First of all, thank you so much for this idea and suggestion! 👍 This small guide should help you to implement your own rule for `eslint-plugin-actool` -1. Look at [CONTRIBUTING](../CONTRIBUTING.md) -2. Run [eslint rule generator](https://www.npmjs.com/package/generator-eslint#eslintrule) -```sh -$ npm run new:rule +## Prerequisite -? What is your name? # {YOUR_NAME} -? Where will this rule be published? # ESLint Plugin -? What is the rule ID? # {RULE_NAME} -? Type a short description of this rule: # {RULE_DESCRIPTION} -? Type a short example of the code that will fail: # (Can be ommited and specified later) -``` +- Read [our CONTRIBUTING doc]("../CONTRIBUTING.md) +- Read [the ESLint docs on creating a new rule.](https://eslint.org/docs/developer-guide/working-with-rules) +- Look at the commit for how previous rules were added as inspiration. -It's all for a while) + -If you have any questions - [official guide](https://eslint.org/docs/developer-guide/working-with-plugins) can help you, I think + +## Tip + +- Use the [**astexplorer** site](https://astexplorer.net) with the `espree` parser and `ESLint v4` transform to interactively create the initial rule implementation. It lets you inspect the full AST as you would get from ESLint and you can even see the result of your auto-fixer implementation. + + +## Steps + +- Run [eslint rule generator](https://www.npmjs.com/package/generator-eslint#eslintrule) + ```sh + $ npm run new:rule + + ? What is your name? # {YOUR_NAME} + ? Where will this rule be published? # ESLint Plugin + ? What is the rule ID? # {RULE_NAME} + ? Type a short description of this rule: # {RULE_DESCRIPTION} + ? Type a short example of the code that will fail: # (Can be ommited and specified later) + ``` + +*While it's all)* + + + > Happy hacking!