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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flat config support ? #31

Open
yuriy-yarosh opened this issue Jan 10, 2024 · 5 comments
Open

Flat config support ? #31

yuriy-yarosh opened this issue Jan 10, 2024 · 5 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@yuriy-yarosh
Copy link

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.

@thekip
Copy link
Collaborator

thekip commented Jan 10, 2024

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.

@yuriy-yarosh
Copy link
Author

yuriy-yarosh commented Jan 11, 2024

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

зображення

@thekip thekip added help wanted Extra attention is needed good first issue Good for newcomers labels Jan 11, 2024
@thekip
Copy link
Collaborator

thekip commented Jan 11, 2024

Go this, thanks. Would you be interesting opening a PR? It seems it's not a complicated change.

@yuriy-yarosh
Copy link
Author

@thekip sure, I'll fix this when I'll get some free time.

@thekip
Copy link
Collaborator

thekip commented Jan 11, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants