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

NX Config requires manuel removal of NX generated eslint settings. #24

Open
mthines opened this issue Mar 29, 2022 · 2 comments
Open

NX Config requires manuel removal of NX generated eslint settings. #24

mthines opened this issue Mar 29, 2022 · 2 comments

Comments

@mthines
Copy link
Contributor

mthines commented Mar 29, 2022

When generating a new lib using NX it automatically generates a .eslintrc.json file which looks somewhat like this:

{
	"extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"],
	"ignorePatterns": ["!**/*"],
	"overrides": [
		{
			"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
			"rules": {}
		},
		{
			"files": ["*.ts", "*.tsx"],
			"rules": {}
		},
		{
			"files": ["*.js", "*.jsx"],
			"rules": {}
		}
	]
}

The current setup requires us to delete the "plugin:@nrwl/nx/react" part, in order to get it working. I think we should find a solution which doesn't conflict which the natural flow of using NX.

Error

[Error - 1:37:36 PM] Error: Plugin "import" was conflicted between "libs/theme/.eslintrc.json » ../../.eslintrc.json » @noaignite-dk/eslint-config/nx » ./typescript » ./index.js" and "libs/theme/.eslintrc.json » plugin:@nrwl/nx/react » plugin:@nrwl/nx/react-base".
    at mergePlugins (/Users/madsthinescoello/Workspaces/nx-boilerplate/node_modules/@eslint/eslintrc/lib/config-array/config-array.js:201:19)
    at createConfig (/Users/madsthinescoello/Workspaces/nx-boilerplate/node_modules/@eslint/eslintrc/lib/config-array/config-array.js:304:9)
    at ConfigArray.extractConfig (/Users/madsthinescoello/Workspaces/nx-boilerplate/node_modules/@eslint/eslintrc/lib/config-array/config-array.js:480:33)
    at CLIEngine.isPathIgnored (/Users/madsthinescoello/Workspaces/nx-boilerplate/node_modules/eslint/lib/cli-engine/cli-engine.js:991:18)
    at CLIEngine.executeOnText (/Users/madsthinescoello/Workspaces/nx-boilerplate/node_modules/eslint/lib/cli-engine/cli-engine.js:900:38)
    at ESLint.lintText (/Users/madsthinescoello/Workspaces/nx-boilerplate/node_modules/eslint/lib/eslint/eslint.js:607:23)
    at func (/Users/madsthinescoello/.vscode/extensions/dbaeumer.vscode-eslint-2.2.2/server/out/webpack:/eslint-server/src/eslintServer.ts:1616:67)
    at withESLintClass (/Users/madsthinescoello/.vscode/extensions/dbaeumer.vscode-eslint-2.2.2/server/out/webpack:/eslint-server/src/eslintServer.ts:1661:10)
    at validate (/Users/madsthinescoello/.vscode/extensions/dbaeumer.vscode-eslint-2.2.2/server/out/webpack:/eslint-server/src/eslintServer.ts:1614:8)
    at /Users/madsthinescoello/.vscode/extensions/dbaeumer.vscode-eslint-2.2.2/server/out/webpack:/eslint-server/src/eslintServer.ts:1550:10
@jdpnielsen
Copy link
Contributor

I think the root cause of this issue is that we provide plugin dependencies via the shareable config, instead of forcing downstream consumers to install modules as peerdependencies. We instead use a patch mechanism provided by https://www.npmjs.com/package/@rushstack/eslint-patch, due to this longstanding, unresolved, issue in eslint: eslint/eslint#3458

I don't see any way to make solution from the eslint-config side of things. One thing we cool look at is providing patched versions of the generators for nx, which work together with our ecosystem.

@jdpnielsen
Copy link
Contributor

Good news on this front, the new eslint format (#42) should resolve this issue. Now we just need to wait for nx to change over, or replace the built in generators.

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