Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(check-param-names): Add disableMissingParamChecks option #1206

Merged
merged 9 commits into from Feb 22, 2024

Conversation

seanpoulter
Copy link
Contributor

@seanpoulter seanpoulter commented Feb 21, 2024

Proposed Changes

  • feat(check-param-names): Add disableMissingParamChecks option
  • test(require-param): Add missing line numbers in errors

    This suppressed fixes the output like this:
    Rule, `require-param`, missing line numbers in errors: 21
    

Things to Note

  • This PR closes Allow ignoring missing @params聽#1169.
  • I believe the tests cases should give us confidence in the behaviour when the option is not provided, and when it is set. Did you want test cases for other languageOptions?
  • I haven't been able to run create-docs locally 馃

@brettz9
Copy link
Collaborator

brettz9 commented Feb 21, 2024

Thanks for the PR.

Re: "Rule, require-param, missing line numbers in errors: 21", I'd prefer we keep that showing up because otherwise we don't know which require-param tests are broken. By the line numbers being missing, we know that the behavior needs to be fixed so that the proper line numbers will result. Suppressing them doesn't help here, it obscures the problem.

@brettz9
Copy link
Collaborator

brettz9 commented Feb 21, 2024

Re: create-docs, yes, there is a bug. Awaiting @gajus to review gajus/gitdown#67 .

@seanpoulter
Copy link
Contributor Author

seanpoulter commented Feb 21, 2024

Re: "Rule, require-param, missing line numbers in errors: 21", I'd prefer we keep that showing up because otherwise we don't know which require-param tests are broken.

Edit: I should have been more careful with my words. I suppressed fixed the output. :)

--

I found and fixed the missing line numbers using this dynamic import with a cache busting query parameter in the Node REPL:

let i = 0;
(await import(`./test/rules/assertions/requireParam.js?i=${i++}`)).default.invalid.filter(a => a.errors.filter(b => b.line === undefined).length !== 0)[0].errors

That finds the first invalid case without a line in the errors and printed the text to find/replace. Thirty iterations later it's better than when I found it.

@brettz9
Copy link
Collaborator

brettz9 commented Feb 21, 2024

Re: "Rule, require-param, missing line numbers in errors: 21", I'd prefer we keep that showing up because otherwise we don't know which require-param tests are broken.

Edit: I should have been more careful with my words. I suppressed fixed the output. :)

What I mean is that we have a bug in require-param. These line numbers should only be added if that bug is fixed by fixing some code in require-param. The line numbers which you added to avoid the errors are not the line numbers we actually want even though they reflect the current behavior.

@seanpoulter
Copy link
Contributor Author

I reverted the changes to require-param. Let me know if you'd rather a comment like // Todo: Fix line number. See issue #? if it'll help save you time later. :)

Copy link
Collaborator

@brettz9 brettz9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beyond my suggestions, I think the PR looks ready...

seanpoulter and others added 2 commits February 22, 2024 06:53
Co-authored-by: Brett Zamir <brettz9@yahoo.com>
Co-authored-by: Brett Zamir <brettz9@yahoo.com>
@seanpoulter
Copy link
Contributor Author

Thanks for your patience and reviews @brettz9!

src/rules/checkParamNames.js Outdated Show resolved Hide resolved
@brettz9
Copy link
Collaborator

brettz9 commented Feb 22, 2024

Thanks for your patience and reviews @brettz9!

No need for patience鈥攚as a solid PR! Thanks again!

@brettz9 brettz9 merged commit ba642e4 into gajus:main Feb 22, 2024
4 checks passed
Copy link

馃帀 This PR is included in version 48.2.0 馃帀

The release is available on:

Your semantic-release bot 馃摝馃殌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow ignoring missing @params
2 participants