Licence
MIT
Version
0.2.1
Deps
1
Size
39 kB
Vulns
0
Weekly
0
eslint-plugin-ad-hok
Ad-hok specific linting rules for ESLint
Installation
Install ESLint
npm install --save-dev eslint
Install the plugin
npm install --save-dev eslint-plugin-ad-hok
Configuration
Using preset
Use the recommended preset to get reasonable defaults:
"extends": [
"ad-hok/recommended"
]
You may also optionally specify settings that will be shared across all the plugin rules.
"settings": {
"ad-hok/possibly-magic-helper-regex": "add.*|suppress.*", // defaults to "add.*"
"ad-hok/nonmagic-helper-whitelist": [
"addTranslationHelpers",
"addEffectOnMount"
],
"ad-hok/should-fix-flow-flowmax": true, // if you're using eslint-plugin-known-imports
}
Manually
If you don't use the preset, include the rules that you wish to use:
"plugins": ["ad-hok"],
"rules": {
"ad-hok/no-unnecessary-flowmax": "error",
"ad-hok/needs-flowmax": "error",
"ad-hok/prefer-flowmax": ["error", "whenUsingUnknownHelpers"],
"ad-hok/no-flowmax-in-forwardref": "error"
},
"settings": { // these are all optional
"ad-hok/possibly-magic-helper-regex": ...,
"ad-hok/nonmagic-helper-whitelist": ...,
"ad-hok/should-fix-flow-flowmax": ...
}
Rules
ad-hok/needs-flowmax- ensure thatflowMax()is used instead offlow()when you are definitely using "magic"ad-hokhelpersad-hok/prefer-flowmax- ensure thatflowMax()is used instead offlow()when you may be using "magic"ad-hokhelpers (or everywhere)ad-hok/no-unnecessary-flowmax- ensure thatflow()is used instead offlowMax()when you are definitely not using "magic"ad-hokhelpersad-hok/no-flowmax-in-forwardref- flag uses offlowMax()insideReact.forwardRef()
Configuration presets
Recommended
This plugin exports a recommended configuration that provides reasonable defaults for enforcing ad-hok best practices
To enable this configuration use the extends property in your .eslintrc config file:
{
"extends": ["plugin:ad-hok/recommended"]
}
See ESLint documentation for more information about extending configuration files
The rules enabled in this configuration are:
ad-hok/needs-flowmaxad-hok/prefer-flowmax(specifically,"ad-hok/prefer-flowmax": ["error", "whenUsingUnknownHelpers"])ad-hok/no-flowmax-in-forwardref
License
MIT