-
-
Notifications
You must be signed in to change notification settings - Fork 291
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
ESLint v9 and flat config #774
base: main
Are you sure you want to change the base?
Conversation
I have experimented with adding a If we feel this is something we are ok with, I will add it to this PR as well. We can also discuss #777 here I am open to dropping formatting support prettier while supporting prettier compatibility as an option. @sindresorhus I know this is a big PR and difficult to figure out the right approach or if we want to support the new implementation or design decisions that I made. If you feel you'd like a different approach to getting this merged in or accomplished, I am open to it. perhaps adding the flat-config behind a flag in the current CLI would work and make it a safer change. The reason I didn't do that as step 1 is because it will be a bit odd with the JS/TS boundary. It's also tough as we'd need to support multiple versions of the same dependencies in 1 repo. which may go poorly. If you'd like, I will try to work on getting this PR to a more "integrated" and safe state for merging, but if you have suggestions for this let me know. |
Given the size of the PR, I'd keep that for a follow-up instead. |
Thanks for working on this and sorry about the slow response. I think this is the right approach. Better to rip off the bandaid than complicate things with flags. Is it not possible to support config in package.json anymore? Pretty much all I used it for is to disable some rules, so maybe we could support a limited set? Like only disabling rules? Before we eventually merge this, it would be great if you could run a script to convert indentation to tab-indentation. I could do it too, but then I would create noise for all the changes you did. |
I'm open to it, but should definitely be in a follow-up PR. |
Sure! I had been debating this anyway I think its a good value add for the xo cli/editor extension to be able to use package.json. We can support any parts of the config that are serializable, so basically everything except plugins I think and some language settings maybe. So supported config types will be:
optionally it would be trivial to add I think its nice to give users a better reason to stick with xo eco system entirely since this PR gives them an easier way to integrate xo with eslint directly. |
Yes, I'll take care of this as well. |
@@ -1,126 +1,114 @@ | |||
{ | |||
"name": "xo", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be great if you could restore this file to how it was, with only the script and dependencies changes.
--plugin Include third-party plugins [Can be set multiple times] | ||
--extend Extend defaults with a custom config [Can be set multiple times] | ||
--open Open files with issues in your editor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to support this one.
--cwd=<dir> Working directory for files | ||
--stdin Validate/fix code from stdin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the plan here?
But should we? I'm mainly interested in it for quick workaround like disabling/overriding some rules. If users needs to change a lot, it's probably better to create a config file. And also, by supporting many but not all things in package.json, it can create some confusion. |
My version of
xo
with flat config support.It's a complete re-write obviously here in TS and this is the initial PR WIP, let me know what you think.
It seems to work pretty darn well for me so far as a drop replacement in the repos I have tested it on and it works out of the box with the vscode extension.
It also exports a
createEslintConfig
function, for users who'd rather use eslint directly but get (almost) all of the goodies from usingxo
cli directly.The docs probably need work still and test coverage could definitely be better, I think some features are probably gone as well, I know I didn't add webpack import resolver yet and probably a few other things, so let me know if its missing something you feel is important.
You can test out a beta version https://www.npmjs.com/package/@spence-s/flat-xo which I will deprecate if this PR is accepted.
easy to replace in package.json
"xo": "npm:@spence-s/flat-xo@latest"