@homebound/eslint-plugin
v1.3.3
Published
Custom rules for homebound projects
Readme
eslint-plugin-homebound-rules
custom rules for homebound projects
Installation
You'll first need to install ESLint:
yarn add -D eslintNext, install @homebound/eslint-plugin:
yarn add -D @homebound/eslint-pluginUsage
Add homebound-rules to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:
{
"plugins": ["@homebound"]
}Then configure the rules you want to use under the rules section.
{
"rules": {
"@homebound/no-b-add-column": 2
}
}Adding Rules
| Name | Description | | :------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------- | | no-b-add-column | we should be using the custom addColumn for indexing purposes, rather than the MigrationBuilder's addColumn | | no-cyanaudit-in-migrations | Prevents running cyanaudit logic in migrations | | prevent-test-file-imports-in-app-code | Prevents importing test code in application logic |
This repository followed this tutorial to initialize.
TL;DR:
Init
yarn yo eslint- Add a:
Rule - Name:
homebound - Publish:
ESLint Plugin - ID: Name it, such as
no-b-add-column - Description: Short sentence. This will show up in a lot of default places: Documentation Headers, Errors, etc.
Next Steps
- Find your new doc in
docs/rules/your-rule.md - Link to the doc in README.md
- Add some tests via
test/lib/rules/your-rule.js - Finally, visit something like astexplorer.net to dive into the AST and start writing your rule.
- under the "Transforms" tab on the top you may hit
babel-eslintto quickly test a tool in the UI. Add pass/fail code to the top left, and iterate on your rule in the bottom left. The bottom right will show the ESLint output of your rule. Use the Top Right to explore the AST (I suggest turning on Methods, and turning off Location Data and Type Keys)
- under the "Transforms" tab on the top you may hit
