- Bootstrap project
npm i -g yo generator-eslint
mkdir eslint-plugin-my-plugin
cd eslint-plugin-my-plugin
yo eslint:plugin
yo eslint:rule
npm i
- Go to https://astexplorer.net/
- Select espree as the parser
- Select Eslint v4 as the transform
- Add sample code to lint in the top-left box. The top-right box shows the AST tree
- Find the node you need to target
- Write the rule in the bottom-left box. The bottom-right box shows the output from the rule
- Copy the return statement of the create function in the bottom-left box to the JavaScript rule file
- Add tests
- Save and publish