Comments (6)
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
).
from eslint-plugin-regexp.
Unicorn didn't use /config
because this requires exports
to be added in package.json, since it should support both import and require.
from eslint-plugin-regexp.
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:
- Use
configs.recommended
namespace.
plugin.configs.recommended
is reserved for legacy configurations.
I don't want to change it for backwards compatibility. - Use a new namespace.
I don't want to use names likeplugin.flatConfigs.recommended
, andplugin.configs.flatRecommended
. "Flat" quickly becomes meaningless.
Also, I think it is difficult to understand the difference betweenconfig
andconfigs
.
I'm not sure what namespace to use instead that would be easier for people to use. - Use new
*.js
file.
e.g.import { recommended } from 'eslint-plugin-regexp/configs'
. - Make
plugin.configs
an object-like function with properties.
e.g.plugin.configs('recommended')
.
from eslint-plugin-regexp.
eslint-plugin-unicorn
decide to use plugin.configs['flat/recommended']
, its used in ESLint blog post, see also discussion.
from eslint-plugin-regexp.
Thank you for sharing the discussion! I will check it.
from eslint-plugin-regexp.
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']
- eslint-plugin-unicorn https://github.com/sindresorhus/eslint-plugin-unicorn/blob/eb5af8bbd95f6bce3ad550c767bb63cec835719e/readme.md#preset-configs-eslintconfigjs
- eslint-plugin-jsdoc https://github.com/gajus/eslint-plugin-jsdoc/blob/7461e0182827af0c6355dfeec50315953c6fb3de/README.md#user-content-eslint-plugin-jsdoc-configuration-flat-config
- eslint-stylistic https://github.com/eslint-stylistic/eslint-stylistic/blob/5d2c1d7dfb366fcc4186b68187709657d2dc702c/docs/guide/config-presets.md#static-configurations
plugin.configs['recommended-flat']
- eslint-plugin-n https://github.com/eslint-community/eslint-plugin-n/blob/4265094e1235dbd741f13ac6c70dd6b2f848452d/README.md#eslintconfigjs-requires-eslintv8230
import recommended from 'eslint-plugin-x/configs/recommended'
- eslint-plugin-eslint-plugin https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/6b53c5b7b8bc9e19dcb86796ab29019f89c449fc/README.md#eslintconfigjs-requires-eslintv8230
- eslint-plugin-react https://github.com/jsx-eslint/eslint-plugin-react/blob/9f4b2b96d92bf61ae61e8fc88c413331efe6f0da/README.md#shareable-configs-1
Renamed legacy configurations (Breaking change)
- eslint-plugin-security https://github.com/eslint-community/eslint-plugin-security/blob/c73effd615b337448ca504926a21907fa089f4f4/README.md#flat-config-requires-eslint--v8230
Useplugin.configs.recommended
for new configuration and'plugin:security/recommended-legacy'
for legacy configuration.
Not supported yet (PR is open)
- eslint-plugin-jsx-a11y jsx-eslint/eslint-plugin-jsx-a11y#891
Maybeimport recommended from 'eslint-plugin-x/recommended'
- typescript-eslint typescript-eslint/typescript-eslint#7935
Maybe new package
Not supported yet
- eslint-plugin-import import-js/eslint-plugin-import#2556
- eslint-plugin-markdown eslint/eslint-plugin-markdown#231
- eslint-plugin-eslint-comments
- eslint-plugin-promise eslint-community/eslint-plugin-promise#449
- eslint-plugin-vue vuejs/eslint-plugin-vue#1291
Unorganized notes
It looks like eslint-config-standard has dropped support for legacy configurations.
https://github.com/standard/eslint-config-standard
from eslint-plugin-regexp.
Related Issues (20)
- `regexp/use-ignore-case` changes matched strings with Unicode HOT 2
- Sort string alternatives HOT 1
- Remove unnecessary elements in class intersections and subtractions HOT 1
- Simplify nested characters classes and expression character classes HOT 4
- Module organization in `lib/utils`? HOT 1
- Disable `require-jsdoc` rule? HOT 1
- Use expression character class instead of lookaround
- Add `require-unicode-sets-regexp`
- `regexp/no-super-linear-move`: default for `ignoreSticky` differs from docs HOT 2
- Add `no-useless-string-literal`
- Force one grapheme in the disjunction of string literals
- Prepare for v2 release. HOT 8
- prefer-predefined-assertion does not recognize `(\.(?!$)|$))` HOT 7
- Make `no-useless-assertion` detect `(?!$)$`
- Add suggestions for `no-useless-assertion`
- `regexp/use-ignore-case` creates a bug HOT 2
- False positive of `regexp/no-unused-capturing-group` with `hasIndices` HOT 1
- Add option to rule `no-unused-capturing-group` to allow unused named capturing groups HOT 2
- Additional `/` character was added to my character class in autofix HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eslint-plugin-regexp.