Skip to content
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

Document how to use plugin configuration via ESLint #626

Closed
fregante opened this issue Oct 27, 2021 · 8 comments
Closed

Document how to use plugin configuration via ESLint #626

fregante opened this issue Oct 27, 2021 · 8 comments

Comments

@fregante
Copy link
Member

fregante commented Oct 27, 2021

eslint-config-xo can be used from eslint:

{
	"extends": "xo"
}

But it does not include the plugin config:

https://github.com/xojs/xo/blob/a30cf0b710063953a015066bdfd9514eab41900c/config/plugins.cjs

Is it possible to move it to eslint-config-xo and use it as such?

{
	"extends": [
		"xo",
		"xo/import",
		"xo/node",
		etc

		// or
		
		"xo/with-plugins",
	]
}
@sindresorhus
Copy link
Member

Same answer as #618 (comment)

@fregante
Copy link
Member Author

fregante commented Oct 27, 2021

Is it? I'm setting most plugin configuration via my custom config here, both via extend: [plugin:"import/recommended"] and by setting each rule:

https://github.com/fregante/eslint-config-pixiebrix/blob/60f5a8837066009757fc293faa65636ad57fde14/index.js#L27-L31

And then I'm just extending the single shared config as usual:

https://github.com/pixiebrix/pixiebrix-extension/blob/2914608a3c37ebd93fecc03781449b9f79acefd9/.eslintrc#L3-L6

I'm not even installing each plugin separately, they're part of eslint-config-pixiebrix’ dependencies

https://github.com/pixiebrix/pixiebrix-extension/blob/2914608a3c37ebd93fecc03781449b9f79acefd9/package.json#L217-L218

I think technically I could add xo as a dependency and use extend: ["./node_modules/xo/config/plugins.cjs"], but that obviously is a mess.

@fregante
Copy link
Member Author

If it doesn't break the current usage, I'd move plugins.cjs to the eslint-config-xo package as its own file. XO can continue to import it as usual, I suppose, and others will be able too.

@sindresorhus
Copy link
Member

eslint/eslint#3458

@fregante
Copy link
Member Author

I know, but it works for me and I don't know why.

Either way, my suggestion was not to change the dependency setup, but just to move the file to the eslint-config-xo, which should still be fine for XO itself and has the potential of working for others through the config as well.

@sindresorhus
Copy link
Member

Even if it works for you, it's not something that is officially supported. I have wasted so much time on weird config resolution issues with XO and ESLint in the past year. I don't want to risk any more issues by moving the file out. I recommend just copy-pasting the useful stuff in plugins.js for now. This will all be fixed properly at some point.

@fregante
Copy link
Member Author

I have wasted so much time on weird config resolution issues with XO and ESLint in the past year.

Speaking of which: 0.46.1 0.46.2 0.46.3 😅

I was having issues with it yesterday but did not have the time to investigate

@sindresorhus
Copy link
Member

Yeah... Try 0.46.3. It fixes it for sindresorhus/ow at least.

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

No branches or pull requests

2 participants