Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add options to generate a Flat Config#25

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
JoostKersjes wants to merge3 commits intovuejs:main
base:main
Choose a base branch
Loading
fromJoostKersjes:flat-config

Conversation

JoostKersjes
Copy link

@JoostKersjesJoostKersjes commentedApr 11, 2024
edited
Loading

vuejs/create-vue#451

Things I have yet to do:

  • bin/create-eslint-config.js changes
  • Check if any packages containeslint:recommended oreslint:all
  • OmitFlatCompat from default + JS + no Prettier
  • Add compatibility forcreateAliasSetting
  • Only add dependencies@eslint/js &@eslint/eslintrc when actually needed

Some questions:

  1. With the--ext CLI flag gone, where should the file path match patterns come from? I thinkcreate-vue can set them, but what about the manual create use case? Should both get the same defaultfiles: []?
  2. Since the--ignorePath CLI flag is gone, should ignore patterns now also be part of this project? If so, should that be in this PR?
  3. How would I go about testing all of the different combinations? I'll start by manually creating a bunch of projects on my local machine I guess.

danwulff and Captainpast reacted with thumbs up emoji
@JoostKersjesJoostKersjesforce-pushed theflat-config branch 3 times, most recently from1a9f098 to4edf18cCompareApril 11, 2024 20:36
@JoostKersjes
Copy link
Author

That's me done for today. Just tested one scenario and didn't encounter errors :)

  • npm create vue@latest with TS, router, pinia, ESLint and Prettier
  • pnpm i
  • pnpm add -D eslint@latest
  • Manually changedpackage.json to"lint": "eslint . --fix",
  • node ~/scratchpad/create-eslint-config/bin/create-eslint-config.js
    image
    /* eslint-env node */importpathfrom'node:path'import{fileURLToPath}from'node:url'import{FlatCompat}from'@eslint/eslintrc'importpluginVuefrom'eslint-plugin-vue'importjsfrom'@eslint/js'const__filename=fileURLToPath(import.meta.url)const__dirname=path.dirname(__filename)constcompat=newFlatCompat({baseDirectory:__dirname,recommendedConfig:js.configs.recommended})exportdefault[  ...pluginVue.configs['flat/essential'],js.configs.recommended,  ...compat.extends('@vue/eslint-config-typescript'),  ...compat.extends('@vue/eslint-config-prettier/skip-formatting'),{files:[],languageOptions:{ecmaVersion:'latest'}}]
  • Manually changedeslint.config.js tofiles: ['**/*.vue', '**/*.js', '**/*.jsx', '**/*.cjs', '**/*.mjs', '**/*.ts', '**/*.tsx', '**/*.cts', '**/*.mts'],
  • pnpm lint --> Success 🎉

I don't know for sure that all the rules work properly, but a nice first result.

@JoostKersjesJoostKersjes marked this pull request as ready for reviewApril 12, 2024 17:46
@JoostKersjesJoostKersjes changed the titleDraft: Add options to generate a Flat ConfigAdd options to generate a Flat ConfigApr 12, 2024
@JoostKersjes
Copy link
Author

This should now be ready for review!

As for now, I'll go and test the various configs increate-vue projects and report back with some results.

@JoostKersjes
Copy link
Author

Back with some results. In general, the common configs seem to work.

The only parsing error I encountered was with scenario 8, which I haven't looked into.

You can view the results in this Gist:https://gist.github.com/JoostKersjes/0e6495987a74df8ebf4527f35d924e27

@juliandreas
Copy link

Just out of curiosity, why give the option of using the deprecatedeslintrc? 🤔

@JoostKersjes
Copy link
Author

JoostKersjes commentedApr 16, 2024
edited
Loading

Just out of curiosity, why give the option of using the deprecatedeslintrc? 🤔

Made me think for a bit, thanks. I didn't want to be too disruptive with this MR so it could be more easily reviewed, so I didn't want to remove the old code.

From my perspective, the adoption of flat configs has been slower than I expected. Most of the packages aren't compatible and only have instructions for using aneslintrc config. This didn't give me a lot of confidence.

Using packages wrapped inFlatCompat wasn't as smooth as I hoped it to be when I did the ESLint v9 migration at work. I thought that it might be nice to opt out as long as the compatibility layer is needed.

PS: It seems that only a small group of people would runnpm create @vue/eslint-config@latest themselves instead of just using whatevernpm create vue@latest gives them. If someone wants to generate a specific config file, I'd guess that more options are better.

juliandreas and Yordan-Ramchev reacted with thumbs up emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@JoostKersjes@juliandreas

[8]ページ先頭

©2009-2025 Movatter.jp