eslint-plugin-ad-hok v0.2.1
eslint-plugin-ad-hok
Ad-hok specific linting rules for ESLint
Table of Contents
Installation
Install ESLint
npm install --save-dev eslint
# or, if you're using yarn:
yarn add --dev eslint
Install the plugin
npm install --save-dev eslint-plugin-ad-hok
# or, if you're using yarn:
yan add --dev eslint-plugin-ad-hok
Configuration
Using preset
Use the recommended
preset to get reasonable defaults:
"plugins": ["ad-hok"],
"extends": [
"plugin:ad-hok/recommended"
]
Or, if you're using Typescript, use the recommended-typescript
preset to get reasonable defaults
for Typescript + React projects:
"plugins": ["ad-hok"],
"extends": [
"plugin:ad-hok/recommended-typescript"
]
You may also optionally specify settings that will be shared across all the plugin rules.
"settings": {
"ad-hok/should-rewrite-importable-names": 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-flowmax-in-forwardref": "error",
"ad-hok/dependencies": "error"
}
Rules
ad-hok/no-flowmax-in-forwardref
- flag uses offlowMax()
insideReact.forwardRef()
ad-hok/dependencies
- check that dependencies arguments match used propsad-hok/require-adddisplayname
- check that components set a display name withaddDisplayName()
Typescript-specific rules:
ad-hok/cleanupprops-last
- check thatcleanupProps()
is only used at the end of ad-hok helper chainsad-hok/annotate-handler-param-types
- check that handler params have explicit type annotations
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:
{
"plugins": ["ad-hok"],
"extends": ["plugin:ad-hok/recommended"]
}
See ESLint documentation for more information about extending configuration files
The rules enabled in this configuration are:
ad-hok/no-flowmax-in-forwardref
ad-hok/dependencies
(specifically,"ad-hok/dependencies": ["error", {"effects": false}]
)
Recommended-Typescript
This plugin exports a recommended-typescript
configuration that provides reasonable defaults for enforcing ad-hok
best practices when
you're using Typescript
To enable this configuration use the extends
property in your .eslintrc
config file:
{
"plugins": ["ad-hok"],
"extends": ["plugin:ad-hok/recommended-typescript"]
}
The rules enabled in this configuration (in addition to the rules listed for the recommended
preset above) are:
Help / Contributions / Feedback
Please file an issue or submit a PR with any questions/suggestions
License
MIT
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago