fix: merge overrides with the same file patterns#244
Conversation
| }, | ||
| }, | ||
| { | ||
| files: ['**/*.ts', '**/*.tsx'], |
There was a problem hiding this comment.
this is kept because it is just one pass of the various steps, so we haven't removed files-only overrides yet.
ecbdf0b to
8d713dd
Compare
|
Here's an eslint config: export default tseslint.config([
react.configs.flat['jsx-runtime'],
{
plugins: {
"react": react,
'@typescript-eslint': tseslint.plugin,
},
languageOptions: {
parser: tseslint.parser,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
rules: {
'react/jsx-no-target-blank': [
'error',
{
// Default value for this is false
allowReferrer: true,
},
],
},
},
{
files: ['**/*.ts', '**/*.tsx'],
rules: {
'react/jsx-no-target-blank': 'error'
},
},
]);
So, what happens when I have this code in <a href='https://joinmastodon.org' target='_blank' rel='noopener'>
<FormattedMessage id='footer.about' defaultMessage='About' />
</a>The second config object inherits the base configuration's config for this rule, and so allows excluding oxlint (or oxlint-migrate's interpretation of the eslint config I guess idk) does not do this. So that's one source of difference here. |
|
Thank you for working on this!
Does it mean that the second block does not really override the settings, but only the severity (in ESLint)? |
Yeah, in ESLint it only overrides the severity and is probably, technically a bug in oxlint's config resolution behavior, unfortunately. |
8d713dd to
b914a4d
Compare
|
After testing this on a decent number of configs, I think this is pretty good and ready to go. We still have the issue described above, but I think that's out-of-scope for this fix for now. |
|
@Sysix ready for review when you have time :) |
b914a4d to
db9df3e
Compare
|
Thank you for the work (and the wait)! :) |
|
No worries, thank you! |
I created a very minimal reproduction test for this issue, and I believe I've fixed it,
but it may have other consequences that need to be figured out and resolved.I'm pretty confident in this nowThis was heavily AI-assisted after adding the tests, so I need to test it further, but based on the snapshots it seems like a pretty good solution.
See #240 for more info.
As an example of how much this fixes, I've been using the mastodon repo as a testing ground for the migrate package: