ota-meshi / eslint-plugin-regexp

ESLint plugin for finding regex mistakes and style guide violations.
https://ota-meshi.github.io/eslint-plugin-regexp/
MIT License
689 stars 10 forks source link

Support flat config (eslint.config.js) #695

Closed fisker closed 6 months ago

fisker commented 8 months ago

See https://eslint.org/docs/latest/use/configure/configuration-files-new

ota-meshi commented 8 months ago

I'm still wondering how best practice is to export a new shareable configuration 🤔 I would like to export using the same method as the popular eslint-plugin, but I don't know what it is yet.

Otherwise, I can think of the following method:

fisker commented 8 months ago

eslint-plugin-unicorn decide to use plugin.configs['flat/recommended'], its used in ESLint blog post, see also discussion.

ota-meshi commented 8 months ago

Thank you for sharing the discussion! I will check it.

ota-meshi commented 8 months ago

This is just a note of my research. I looked into how each plugin supported flat configurations. By the way, none of the plugins I maintain support flat configurations yet.

plugin.configs['flat/recommended']

import recommended from 'eslint-plugin-x/configs/recommended'

Renamed legacy configurations (Breaking change)

Not supported yet (PR is open)

Not supported yet


Unorganized notes

It looks like eslint-config-standard has dropped support for legacy configurations. https://github.com/standard/eslint-config-standard

bradzacher commented 8 months ago

Note: @typescript-eslint is using a new package because we have both the plugin and the parser. It does also help us out as we don't even need to think about the problem cos it comes for free heh.

The advice from upstream is the breaking change approach - though I don't like it, personally as it's making second class citizens of users not on flat configs.

There's no specific reason that you need to make it available on the .config export of your package. You could also do it as a different exported name, or a separate path (eslint-plugin-regexp/config).

fisker commented 8 months ago

Unicorn didn't use /config because this requires exports to be added in package.json, since it should support both import and require.