npm install @ottofeller/eslint-plugin-ottofeller --save-dev
Add ottofeller
to the plugins section of your eslint configuration:
{
"plugins": [
"@ottofeller/ottofeller"
]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"@ottofeller/ottofeller/rule-name-without-options": [
"error"
],
"@ottofeller/ottofeller/rule-name-with-options": [
"error",
{
"option": "value"
}
]
}
}
- ottofeller/jsx-newline-block
{
"rules": {
"@ottofeller/ottofeller/jsx-newline-block": ["error"]
}
}
- ottofeller/require-comment-before-useeffect
The rule has a single option, which is an object with require
property. The latter one is an object that defines the following options:
CallExpression
- requires a comment beforeuseEffect(...)
; defaults to true.MemberExpression
- requires a comment beforeReact.useEffect(...)
; defaults to true.
{
"rules": {
"@ottofeller/ottofeller/require-comment-before-useeffect": ["error", {
"require": {
"CallExpression": true,
"MemberExpression": false,
}
}],
}
}
All the options are enabled by default. To use defaults just keep the config object off.
{
"rules": {
"@ottofeller/ottofeller/require-comment-before-useeffect": ["error"],
}
}
- ottofeller/no-import-react
The rule forbids namespace and default imports from React. Named imports are encouraged.
{
"rules": {
"@ottofeller/ottofeller/no-import-react": ["error"],
}
}
- ottofeller/object-properties-multiline-padding
For multiline Object Expressions the rule requires:
- empty lines before and after multiline properties;
- no empty lines between single-line properties;
- no empty lines at the start and at the end of the object.
NOTE: the rule does not handle comments within Object Expressions.
An autofix is available for the rule.
{
"rules": {
"@ottofeller/ottofeller/object-properties-multiline-padding": ["error"],
}
}