-
-
Notifications
You must be signed in to change notification settings - Fork 738
docs(linter): Fix the rule config docs for eslint/no-inner-declarations rule.
#16556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: handle-tuple-rules-better
Are you sure you want to change the base?
Conversation
…ex config shapes. This will make it much easier to handle rules which accept tuples. I still need to fix a few things, though.
…mplify some things. This will hopefully also ensure that the most common case (a default config object for a given rule) is fast. But I still need to simplify the rest of the code here.
…imize it with this.
… now that we can do tuples in DefaultRuleConfig. This is a proof-of-concept to confirm that these updates to the DefaultRuleConfig tuple handling work as intended and simplify the code :)
…tions rule. I'm pretty sure there's a bug in this rule. It doesn't seem like it should've been returning `None` for the `block_scoped_functions` value by default, the original ESLint rule returns "allow" by default. But I left the behavior alone here, we can address that later if we want to.
I'm pretty sure the no_inner_declarations rule has a bug in it right now, so it failing here isn't really indicative of any problem with the . It's very odd to me that it was defaulting to None for the `block_scoped_functions` instead of `Allow`, I don't understand why that was done and it seems like there are behavioral differences vs. the original rule as a result.
…-body-style` rule.
I'd rather just leave it as-is for now so that we can focus on the other changes in this PR. I'll open another PR with the code cleanup on this rule.
CodSpeed Performance ReportMerging #16556 will not alter performanceComparing Summary
Footnotes
|
|
Marking as a draft until we have a discussion on whether this current behavior is the desired one. |
ca59885 to
962bfe2
Compare
| sort_order, | ||
| SortKeysOptions { case_sensitive, natural, min_keys, allow_line_separated_groups }, | ||
| ))) | ||
| serde_json::from_value::<DefaultRuleConfig<SortKeys>>(value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we can use serde_json::from_value::<SortKeys>(value) here, so the change to DefaultRuleConfig is unnecessary?
This fixes the
no-inner-declarationsdocs by treating them as a tuple. Although, it also breaks the tests for no-inner-declarations. 🙃I think there may be a bug in the tests/logic for our
no-inner-declarationsrule (I think oxc assumes strict mode by default maybe?). We previously returnedNoneforblock_scoped_expressionsinstead ofallow, which the original rule does not do. It always just setsallowas the default value as far as I can tell.I'm unsure if I should add an
impl Default for NoInnerDeclarationsConfigObjectand set it to return None, and retain that behavior, or if we should fix this behavior to match the original ESLint rule better? Up to cam, probably.Generated docs: