Replies: 4 comments 8 replies
-
@nstepien excellent writeup. You may want to create a dedicated comment for each rule so that the discussion around a rule can be threaded (similar to this discussion) |
Beta Was this translation helpful? Give feedback.
-
@nstepien about If you think about it, the example you pasted is the reason the rule exists, to begin with. In your example, you want to stop the propagation of the event, but you need to control the propagation of the |
Beta Was this translation helpful? Give feedback.
-
"noUnusedVariables": {
"level": "error",
"options": {
"except": [ "test", "describe", "it", "..." ]
}
}
|
Beta Was this translation helpful? Give feedback.
-
@ematipico Hi.Can I disable useKeyWithClickEvents rule? Even if I am wrong. {
"$schema": "./node_modules/rome/configuration_schema.json",
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"suspicious": {
"lint/a11y/useKeyWithClickEvents": "off"
},
"style": {
"lint/a11y/useKeyWithClickEvents": "off"
}
}
}
} But no works.Thanks. |
Beta Was this translation helpful? Give feedback.
-
useKeyWithClickEvents
I think it's a good rule in general, but it also flags code like the following, which I think are valid cases to only have click handlers:
useSimplifiedLogicExpression
Probably the most perplexing rule for me
Rome suggest replacing this with
Is it really "simplified"?
Sure it's simpler to a machine, but I find it less human-readable,
in the original line I can read it left to right, in the suggested line I read it as "both b and c must be truthy, then get the opposite boolean value...".
Now replace
b
andc
with actual variable names and it gets more difficult to read.It might also make things harder to change/maintain, as I may have to unroll the parentheses and reapply negations, while being careful not to forget to swap the logical operator.
noUndeclaredVariables
This one doesn't handle other jest's globals for example, such as
describe
,it
,test
,expect
,{before,after}{All,Each}
, ...It isn't useful in TS files at least.
noUnusedVariables
I wish it would ignore unused function parameters that precede a used parameter, for example:
Prefixing
req
with an underscore is noise, and would require removing it if we start using it.VSCode already fades the parameter to indicate that it's unused.
That could be an option perhaps.
Another option would be to allow unused destructured variables as a way to clone object with removed properties.
It should also suggest removing unused errors in
catch
clausesuseSingleCaseStatement
It requires braces around virtually all cases, as cases usually have
break;
+ at least 1 more statement.If it required braces only on cases with an assignment like the ESLint counterpart then I'd be happy.
noImplicitBoolean
Has this ever been an issue? I don't think I've ever seen someone complain about an implicit
true
.Is it useful in non-TypeScript codebases perhaps?
I don't think I've ever seen
prop={true}
in an API documentation, for example:From the React docs themselves: https://reactjs.org/docs/forms.html#the-select-tag
From the react-router docs: https://reactrouter.com/en/main/route/route#index
Even in pure html it is allowed:
and Chrome's devtools:
We enforce the opposite with this ESLint rule: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
useBlockStatements
We use ESLint's
curly
rule with themulti-line
setting, but Rome requires braces even on one-liners:I wish Rome had a similar option.
Beta Was this translation helpful? Give feedback.
All reactions