feat: add meta.defaultOptions#17656
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
✅ Deploy Preview for docs-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
Hi everyone, it looks like we lost track of this pull request. Please review and see what the next steps are. This pull request will auto-close in 7 days without an update. |
This comment was marked as outdated.
This comment was marked as outdated.
|
Not stale. @JoshuaKGoldberg there's a review comment for you to look into. Thanks. |
This comment was marked as outdated.
This comment was marked as outdated.
|
Hi @JoshuaKGoldberg!, thanks for the Pull Request The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.
To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page. Read more about contributing to ESLint here |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
Hi everyone, it looks like we lost track of this pull request. Please review and see what the next steps are. This pull request will auto-close in 7 days without an update. |
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
mdjermanovic
left a comment
There was a problem hiding this comment.
LGTM, thanks! Leaving open for @nzakas to verify.
I'll just convert it to draft to prevent accidental merging until we commit #17656 (comment).
Seems like eslint#17656 introduced an unintended change in `no-warnings-comments.js` where before it roughly looked like: ```js var configuration = context.options[0] || {}; var decoration = [...configuration.decoration || []].join(""); ``` And afterwards it looks like: ```js const [{ decoration, location, terms: warningTerms }] = context.options; ``` Which unintentionally(?) removes the `context.options[0] || {}` default, which eg. causes `eslint-plugin-unicorn@<15.0.1` to fail (see sindresorhus/eslint-plugin-unicorn#2497) Since this happened in a minor `eslint` release but the fix for `eslint-plugin-unicorn` is only available as a patch to its latest major, this is causing me some issues. My guess is that you won't be wanting to merge this though as `eslint-plugin-unicorn` is [extending that rule](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/8b7c5fcf5c9743db4afde0bb9c90cc51782d47ef/rules/utils/get-builtin-rule.js#L4) through: ```js require('eslint/use-at-your-own-risk').builtinRules.get('no-warning-comments') ``` And as discussed in eslint#19013 you don't consider that a good practise: > It's in unstable APIs because rule APIs are indeed not stable > Core rules are not intended to extended any you do so at your own risk Perhaps eslint#19013 or similar can suggest an alternative for eg. `eslint-plugin-unicorn` to avoid this happening again in the future, but my guess is you consider such suggestions to be out of scope of `eslint` and as such to not be something you ant to get involved in. Here's a PR fixing the regression at least, you decide if you want to accept it or reject it 🤷♂️
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[x] Add something to the core
[ ] Other, please explain:
What changes did you make? (Give an overview)
Augments linting to factor in a new optional
meta.defaultOptions. If a rule describes default options this way, any user-provided options are merged on top of the default options.These defaults are applied by a new
deepMergeArraysutility in:ConfigValidatorLinterin two places:getRuleOptionshelpergetRuleOptionsInlinehelperRuleValidatorinsteadRuleValidatorIs there anything you'd like reviewers to focus on?
meta.defaultOptionson rules rfcs#113Co-authored-by: Milos Djermanovic milos.djermanovic@gmail.com