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

Bug: Key "plugins": Cannot redefine plugin "@typescript-eslint" #97

Closed
1 task
daniele-zurico opened this issue Apr 15, 2024 · 4 comments · Fixed by #94
Closed
1 task

Bug: Key "plugins": Cannot redefine plugin "@typescript-eslint" #97

daniele-zurico opened this issue Apr 15, 2024 · 4 comments · Fixed by #94
Labels
accepted bug Something isn't working

Comments

@daniele-zurico
Copy link

Environment

Node version: v20.11.1
npm version: 10.2.4
Local ESLint version: 8.57.0
Global ESLint version: -
Operating System: OS 14.4.1

What parser are you using?

Default (Espree)

What did you do?

I followed the getting started configuration: https://eslint.org/docs/latest/use/getting-started and after it finishes the packages of my library are:

"@babel/core": "7.24.3",
    "@babel/preset-env": "7.24.3",
    "@babel/preset-react": "7.24.1",
    "@babel/preset-typescript": "7.24.1",
    "@commitlint/config-conventional": "17.7.0",
    "@eslint/eslintrc": "^3.0.2",
    "@eslint/js": "^9.0.0",
    "@storybook/addon-a11y": "^8.0.5",
    "@storybook/addon-actions": "^8.0.5",
    "@storybook/addon-controls": "^8.0.5",
    "@storybook/addon-docs": "^8.0.5",
    "@storybook/addon-essentials": "^8.0.5",
    "@storybook/addon-links": "^8.0.5",
    "@storybook/addon-mdx-gfm": "^8.0.5",
    "@storybook/addon-webpack5-compiler-babel": "3.0.3",
    "@storybook/blocks": "^8.0.5",
    "@storybook/manager-api": "^8.0.5",
    "@storybook/preview-api": "^8.0.5",
    "@storybook/react": "^8.0.5",
    "@storybook/react-webpack5": "^8.0.5",
    "@storybook/theming": "^8.0.5",
    "@testing-library/jest-dom": "6.1.2",
    "@testing-library/react": "14.0.0",
    "@testing-library/user-event": "14.4.3",
    "@types/jest": "^29.5.4",
    "@types/mock-fs": "4.13.1",
    "@types/react": "18.2.21",
    "@types/react-dom": "18.2.7",
    "@typescript-eslint/eslint-plugin": "^6.4.0",
    "babel-loader": "9.1.3",
    "chromatic": "6.24.1",
    "codecov": "3.8.3",
    "commitlint": "17.7.1",
    "cssnano": "6.0.1",
    "cssnano-preset-default": "6.0.1",
    "eslint": "^8.0.1",
    "eslint-config-standard-with-typescript": "^43.0.1",
    "eslint-plugin-import": "^2.25.2",
    "eslint-plugin-n": "^15.0.0 || ^16.0.0 ",
    "eslint-plugin-promise": "^6.0.0",
    "eslint-plugin-react": "^7.34.1",
    "globals": "^15.0.0",
    "husky": "8.0.3",
    "identity-obj-proxy": "3.0.0",
    "jest": "29.6.4",
    "jest-environment-jsdom": "29.6.4",
    "lint": "0.8.19",
    "microbundle": "0.15.1",
    "mock-fs": "5.2.0",
    "postcss-functions": "4.0.2",
    "postcss-import": "15.1.0",
    "postcss-nesting": "12.0.1",
    "raw-loader": "4.0.2",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-is": "18.2.0",
    "react-live": "4.1.3",
    "resolve-url-loader": "5.0.0",
    "rollup": "3.28.1",
    "rollup-plugin-postcss": "4.0.2",
    "sass": "1.66.1",
    "sourcemap-codec": "^1.4.8",
    "storybook": "^8.0.5",
    "storybook-css-modules-preset": "1.1.1",
    "storybook-design-token": "^3.1.0",
    "ts-jest": "29.1.1",
    "ts-node": "10.9.1",
    "typescript": "*",
    "typescript-eslint": "^7.6.0"

What did you expect to happen?

to does the lint

What actually happened?

but it's throwing an error:

danielezurico@LIN66006905 dcx-react-library % yarn lint
yarn run v1.22.22
$ eslint src

Oops! Something went wrong! :(

ESLint: 8.57.0

Error: Key "plugins": Cannot redefine plugin "@typescript-eslint".
    at /Users/danielezurico/Documents/Projects/dcx-react-library/node_modules/@humanwhocodes/object-schema/src/object-schema.js:250:27
    at Array.reduce (<anonymous>)
    at ObjectSchema.merge (/Users/danielezurico/Documents/Projects/dcx-react-library/node_modules/@humanwhocodes/object-schema/src/object-schema.js:237:24)
    at /Users/danielezurico/Documents/Projects/dcx-react-library/node_modules/@humanwhocodes/config-array/api.js:935:42
    at Array.reduce (<anonymous>)
    at FlatConfigArray.getConfig (/Users/danielezurico/Documents/Projects/dcx-react-library/node_modules/@humanwhocodes/config-array/api.js:934:39)
    at FlatConfigArray.isFileIgnored (/Users/danielezurico/Documents/Projects/dcx-react-library/node_modules/@humanwhocodes/config-array/api.js:962:15)
    at /Users/danielezurico/Documents/Projects/dcx-react-library/node_modules/eslint/lib/eslint/eslint-helpers.js:312:49
    at Array.reduce (<anonymous>)
    at entryFilter (/Users/danielezurico/Documents/Projects/dcx-react-library/node_modules/eslint/lib/eslint/eslint-helpers.js:299:28)
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Link to Minimal Reproducible Example

https://github.com/Capgemini/dcx-react-library/tree/feat/eslint-2

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

No response

@daniele-zurico daniele-zurico added bug Something isn't working repro:needed labels Apr 15, 2024
@aladdin-add
Copy link
Member

aladdin-add commented Apr 16, 2024

you can remove tseslint - it has been included in eslint-config-standard-with-typescript: https://github.com/Capgemini/dcx-react-library/blob/99fb2ed58bce582b5274a0ef77c1b5a41596ddac/eslint.config.js#L18

@aladdin-add aladdin-add transferred this issue from eslint/eslint Apr 16, 2024
aladdin-add added a commit that referenced this issue Apr 16, 2024
The ts style guide typically depend on tseslint, so there's no need
to install it separately. Doing so might result in multiple versions
being installed, leading to errors.

fixes #97, #98
aladdin-add added a commit that referenced this issue Apr 16, 2024
The ts style guide typically depend on tseslint, so there's no need
to install it separately. Doing so might result in multiple versions
being installed, leading to errors.

fixes #97, #98
@daniele-zurico
Copy link
Author

daniele-zurico commented Apr 16, 2024

Hi @aladdin-add,
yes this fixed the first problem. Just as note it wasn't me adding tselint in the eslint.config.js but the command npm init @eslint/config.
However, now is complaining about something different:

yarn eslint src       
yarn run v1.22.22
$ /Users/danielezurico/Documents/Projects/dcx-react-library/node_modules/.bin/eslint src

Oops! Something went wrong! :(

ESLint: 8.57.0

You are linting "src", but all of the files matching the glob pattern "src" are ignored.

If you don't want to lint these files, remove the pattern "src" from the list of arguments passed to ESLint.

If you do want to lint these files, try the following solutions:

* Check your .eslintignore file, or the eslintIgnore property in package.json, to ensure that the files are not configured to be ignored.
* Explicitly list the files from this glob that you'd like to lint on the command-line, rather than providing a glob as an argument.

error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I don't have a .eslintignore file in the current branch. I removed everything.

@aladdin-add
Copy link
Member

aladdin-add commented Apr 16, 2024

eslint-config-standarad-with-typescript does not have good support for the flat configs. you can change to this: #93 (comment)

note it has been deprecated, and we may remove it from the list later.

mdjermanovic pushed a commit that referenced this issue Apr 16, 2024
The ts style guide typically depend on tseslint, so there's no need
to install it separately. Doing so might result in multiple versions
being installed, leading to errors.

fixes #97, #98
@daniele-zurico
Copy link
Author

I think I'll really wait before doing any upgrade ... it looks quite broken at the moment and packages deprecated that will be removed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants