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

Got npm install Warnings When Use eslint-config-airbnb-base #6

Closed
iFwu opened this issue Apr 16, 2019 · 21 comments · Fixed by #229
Closed

Got npm install Warnings When Use eslint-config-airbnb-base #6

iFwu opened this issue Apr 16, 2019 · 21 comments · Fixed by #229
Labels

Comments

@iFwu
Copy link

iFwu commented Apr 16, 2019

I got warnings when use eslint-config-airbnb-base (no React support).

npm WARN jest-websocket-mock@1.1.1 requires a peer of mock-socket@~8.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-airbnb@17.1.0 requires a peer of eslint-plugin-jsx-a11y@^6.1.1 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-airbnb@17.1.0 requires a peer of eslint-plugin-react@^7.11.0 but none is installed. You must install peer dependencies yourself.
@iamturns
Copy link
Owner

Hey @iFwu - thanks for reporting this.

I need to convert this into a monorepo, and publish two npm packages to fix this issue. One package with React plugins, and the other "base" without React plugins (eslint-plugin-jsx-ally and eslint-plugin-react). This change will take some time. I'll post back here when complete and let you know.

Sorry about that. In the meantime, you are safe to ignore the warnings, everything will still operate as expected.

@kripod
Copy link
Contributor

kripod commented Nov 16, 2019

@iamturns Until then, peerDependenciesMeta could be used to mitigate this issue for Yarn users: yarnpkg/rfcs#105

@olivier-blanc-openit
Copy link

olivier-blanc-openit commented Dec 2, 2019

@iamturns What about defining eslint-config-airbnb as an optionalDependency, since it is a superset of eslint-config-airbnb-base?

@meteorlxy
Copy link

optionalDeps will also be installed.

@Zamiell
Copy link
Contributor

Zamiell commented Apr 13, 2020

@iamturns Sorry for the ping, but it has been one year, are there any update on this?

@mgenware
Copy link

@Zamiell You could try my fork of this project with react and jsx deps removed and eslint upgraded to latest version

@kripod
Copy link
Contributor

kripod commented May 31, 2020

@mgenware Unfortunately, the upgrade is not that easy to be pulled off correctly. The Airbnb config is still being updated to ESLint v7 as I'm writing this, and your project also depends on it. This means that unexpected errors may pop up during usage.

@wszydlak
Copy link

Maybe the best option will be to remove airbnb packages from dependencies. Just in your package describe that it will work only if using airbnb configs. And the You should require from user to install airbnb and set this config in extends before yours package?

nicholaschiang added a commit to nicholaschiang/eslint-config-airbnb-typescript that referenced this issue Jul 31, 2020
Fixes iamturns#6 by adding downstream peer dependencies to this package (we add
the React specific dependencies as optional).

This also enables Yarn v2 support (which requires upstream packages to
include their dependency's peer dependencies).
@nicholaschiang
Copy link

Temporary fix if you're using Yarn v2 is just to use the packageExtensions option in your .yarnrc.yml file (see docs):

packageExtensions:
  eslint-config-airbnb-typescript@8.0.x:
    peerDependencies:
      eslint: "^5.16.0 || ^6.8.0 || ^7.2.0"
      eslint-plugin-import: "^2.21.2"
      eslint-plugin-jsx-a11y: "^6.3.0"
      eslint-plugin-react: "^7.20.0"
      eslint-plugin-react-hooks: "^4 || ^3 || ^2.3.0 || ^1.7.0"

betaorbust added a commit to betaorbust/eslint-config-airbnb-typescript that referenced this issue Aug 16, 2020
BREAKING CHANGE: eslint-config-aribnb will need to be installed explicitly, similar to a plugin.
@betaorbust
Copy link

A relatively inexpensive change is removing the dependency for eslint-config-airbnb and adding it to the manual install step, similar to all the plugins.
This would be a breaking change though, so ymmv.
Here's the diff: betaorbust@6e8cf53

I can put it in as a PR if that's a path you'd like to go down.

@IGassmann
Copy link

IGassmann commented Aug 21, 2020

Or split this package as eslint-config-airbnb-base-typescript and eslint-config-airbnb-typescript.

@betaorbust
Copy link

betaorbust commented Aug 21, 2020

Yeah, that's definitely the best long-term solution. I believe that's the concept that @iamturns has in mind from this comment, but it's been a while, so maybe that's a big task. Wanted to offer a low-effort solution (albeit one with a breaking change)

@stalniy
Copy link

stalniy commented Oct 20, 2020

@iamturns so are you OK to make eslint-plugin-jsx-a11y, eslint-plugin-jsx-a11y, eslint-plugin-react-hooks to be optional peer dependencies. If so, I can make a PR, this warnings really irritate

@stalniy
Copy link

stalniy commented Oct 20, 2020

After thinking about this a bit, I think there is no reason to add all that failing peer deps to peer deps meta because this package doesn't depend on it implicitly, eslint-config-aribnb does! And warnings come from that package.

So, the proposed solution is to remove it as a dependency completely. Do the same for esilnt-config-airbnb-base.

Specify eslint-config-airbnb-base as a peer dependency which is required and esilnt-config-airbnb as optional. This will allow us to do this next:

.eslintrc for base package

{
  "extends": ["eslint-config-airbnb-base", "eslint-config-airbnb-typescript"]
}

.eslintrc for react

{
  "extends": ["eslint-config-airbnb", "eslint-config-airbnb-typescript"]
}

And no more warnings, no need for a separate package and everybody is happy :)

Update: anyway, to fix warning eslint-config-airbnb should be moved into peer deps

@stalniy
Copy link

stalniy commented Oct 21, 2020

Workaround for pnpm users (use pnpmfile.js):

// pnpmfile.js
function readPackage(pkg) {
  if (pkg.name === 'eslint-config-airbnb-typescript') {
    const { ['eslint-config-airbnb']: airbnb, ...dependencies } = pkg.dependencies;
    pkg.dependencies = dependencies;

  }

  return pkg;
}

module.exports = {
  hooks: {
    readPackage
  }
};

@nilzona
Copy link

nilzona commented Feb 19, 2021

@stalniy based on your comment above I submitted a proposal. #201

@nilzona
Copy link

nilzona commented Apr 17, 2021

if anyone wants to have typescript support for airbnb-base without these warnings you can try https://www.npmjs.com/package/eslint-config-airbnb-base-ts

@treybrisbane
Copy link

@nilzona what are the differences between your project and @mgenware's one here: #6 (comment) ??

@nilzona
Copy link

nilzona commented Apr 19, 2021

@nilzona what are the differences between your project and @mgenware's one here: #6 (comment) ??

in the airbnb-base case it's not a huge difference, except that when you install the library from my project you will get everything you need. (airbnb-base + peer dependencies, @typescript/eslint-plugin + parser). I would argue that the setup will be somewhat simpler. The project is also converted into a monorepo, making the setup simpler for the airbnb case also.

@slifty
Copy link

slifty commented May 7, 2021

@iamturns would a PR that turns this into a monorepo be helpful or are you feeling like that's not a direction you want to move / you'd want to own that yourself.

@iamturns
Copy link
Owner

🎉 This issue has been resolved in version 13.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment