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

Improve ESLint plugin deduplication #110

Closed
karlhorky opened this issue Mar 28, 2022 · 2 comments · Fixed by #213
Closed

Improve ESLint plugin deduplication #110

karlhorky opened this issue Mar 28, 2022 · 2 comments · Fixed by #213

Comments

@karlhorky
Copy link
Member

karlhorky commented Mar 28, 2022

Review options for simpler deduplication than Yarn Resolutions:

@karlhorky
Copy link
Member Author

Potentially if we switch to pnpm (#195) we don't need to deduplicate plugins anymore because the installation approach pnpm takes avoids the problem.

We could then get rid of this logic in the install script:

packageJson.resolutions = {
...packageJson.resolutions,
// Force installation of the "dependencies" version of these
// ESLint dependencies to avoid conflicting version numbers
// between `eslint-config-react-app` and
// `@upleveled/eslint-config-upleveled` (they use the same
// ESLint dependencies, but may have slightly different
// versions).
//
// These conflicts can result in ESLint errors like:
//
// ESLint couldn't determine the plugin "import" uniquely.
//
// - /home/runner/work/preflight/preflight/node_modules/eslint-plugin-import/lib/index.js (loaded in ".eslintrc.cjs » @upleveled/eslint-config-upleveled")
// - /home/runner/work/preflight/preflight/node_modules/eslint-config-react-app/node_modules/eslint-plugin-import/lib/index.js (loaded in ".eslintrc.cjs » @upleveled/eslint-config-upleveled » eslint-config-react-app")
...[
'@typescript-eslint/eslint-plugin',
'@typescript-eslint/parser',
'eslint-plugin-import',
'eslint-plugin-jest',
'eslint-plugin-jsx-a11y',
'eslint-plugin-react',
'eslint-plugin-react-hooks',
].reduce(
(resolutions, packageName) => ({
...resolutions,
[packageName]: packageJson.devDependencies[packageName],
}),
{},
),
'@typescript-eslint/utils':
packageJson.devDependencies['@typescript-eslint/parser'],
};

@karlhorky
Copy link
Member Author

Leaving this open until the Yarn logic above is removed

karlhorky added a commit that referenced this issue Apr 3, 2023
pnpm v8 enables auto-install-peers by default and this should automatically
install a lot of the dependencies which we have been manually copying from the
config's peerDependencies to the project's devDependencies

Ref: https://pnpm.io/npmrc#auto-install-peers

Closes #110
Closes #212
karlhorky added a commit that referenced this issue Apr 3, 2023
* Remove Yarn installation instructions

* Remove Yarn support, rely on auto-install-peers

pnpm v8 enables auto-install-peers by default and this should automatically
install a lot of the dependencies which we have been manually copying from the
config's peerDependencies to the project's devDependencies

Ref: https://pnpm.io/npmrc#auto-install-peers

Closes #110
Closes #212
karlhorky added a commit that referenced this issue May 5, 2023
Our extension of the eslint-config-react-app has always caused problems:

1. Conflicts between versions of plugins
2. Unnecessary ESLint plugins being installed eg. jest and flowtype

We have worked around 1. with solutions such as Yarn resolutions and moving to
pnpm with auto-install-peers=true:

#110

Since create-react-app is going away, eslint-config-react-app will likely not be
maintained any longer (it has not received any updates for 2 years).

This commit absorbs the contents of eslint-config-react-app into our own config,
where we will maintain it from now on.
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

Successfully merging a pull request may close this issue.

1 participant