Flat config support ?
Using this plugin with flat config is a bit cumbersome atm. It would've been nice to update it to the most recent plugin structure and provide couple flat config examples.
Could you elaborate a bit on that? May be show some examples by what you mean "cumbersome". As far as i understand having "flat" config vs legacy should not affect plugins and rules only the way how you declare them.
should not affect plugins
@thekip It does require very specific structure, and plugin porting, with some backward compat guarantees.
Could you elaborate a bit on that?
This won't work
import lingui from 'eslint-plugin-lingui';
export default [{
files: ['*.js', '*.cjs', '**/src/**/*.js', '**/src/**/*.jsx'],
plugins: {
lingui,
},
rules: {
...lingui.configs.recommended.rules
}
}];
This won't work either...
import lingui from 'eslint-plugin-lingui';
export default [{
files: ['*.js', '*.cjs', '**/src/**/*.js', '**/src/**/*.jsx'],
plugins: {
lingui,
},
rules: {
...Object.fromEntries(Object.entries(lingui.rules).map(([key, value]) => [`lingui/${key}`, 'warn']))
}
}];
Because lingui plugin only exports obsolete rules format, and there are no Configs
Go this, thanks. Would you be interesting opening a PR? It seems it's not a complicated change.
@thekip sure, I'll fix this when I'll get some free time.
Update: i've just checked the plugin, and it seems it's not a subject for the change at least for now. Because it doesn't expose any "recommended" setup, only rules which are not have to be updated.
Waiting on this too. Though I've got a workaround working using Eslint's compatibility library. Let me know if this workaround works with you all as well.
import { fixupPluginRules } from '@eslint/compat'
import lingui from 'eslint-plugin-lingui'
export default [
...
{
files: ['**/*.{ts,tsx}'],
plugins: {
lingui: fixupPluginRules(lingui)
},
rules: {
'lingui/no-unlocalized-strings': 'error',
'lingui/t-call-in-function': 'error',
'lingui/no-single-variables-to-translate': 'error',
'lingui/no-expression-in-message': 'error',
'lingui/no-single-tag-to-translate': 'error',
'lingui/no-trans-inside-trans': 'error'
}
},
...
]