Skip to content

Add support for generating ESLint Flat Config #2319

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

Closed
wants to merge 8 commits into from

Conversation

conradhale
Copy link

Will fix #1291

Needs more work, haven't had the time to work on this lately.

I was thinking it would be better to replace the generated config files with JS functions that dynamically return the correct configuration. Should decrease the size of the library and make the code a bit cleaner with the addition of flat configs and probably wouldn't impact runtime performance much. Most other eslint plugins seem to be doing this as well.

@conradhale
Copy link
Author

It might be a while before I have time to work on this, if any maintainers want to take over this PR, feel free to make any edits.

@FloEdelmann
Copy link
Member

@conradhale Thanks! I added some more commits, could you please have a look at them? I am not sure what is still missing to have full Flat config support, so I am handing this back to you again 🙂

Comment on lines +15 to +18
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module'
}
Copy link
Contributor

Choose a reason for hiding this comment

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

In most cases, you don't need to specify parserOptions. just use:

  languageOptions: {ecmaVersion: 2020, sourceType: 'module'}

eslint will pass it to the parser. So you don't need to specify global.es2015 either.

Copy link
Contributor

Choose a reason for hiding this comment

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

plugins: { vue: module },
...require('./configs/flat/base')
},
'flat/essential': {
Copy link
Member

Choose a reason for hiding this comment

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

I would like to change flat/essential, flat/recommended, and flat/strongly-recommended to the config for Vue3. Use the vue2- prefix to config for Vue2 instead.

@aladdin-add
Copy link
Contributor

@ota-meshi Is there anything blocking this PR from being merged now? I have been implementing npm init @eslint/config for the flat configs, so it would be great see it's officially supported in the plugin. 😄

@aladdin-add
Copy link
Contributor

@conradhale I can pick this up! (if you don't mind :)

@ota-meshi
Copy link
Member

I would like the configuration to be renamed.
Correspond as follows:

We also need test code to test the flat configuration.

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

Successfully merging this pull request may close these issues.

Support for "Flat Config"
4 participants