Running `yarn lint` fails if `yarn build` not run first
See original GitHub issue… unless you run yarn build first!
That’s a bit counterintuitive to me, I’d expect yarn lint to work as a “standalone” command.
Is that because of the way the project is configured in packages?
Repro:
- Get a fresh clone of the repo
- Run
yarn install - Run
yarn lint - Error from ESLint:
Oops! Something went wrong! :(
ESLint: 6.8.0.
ESLint couldn't find the plugin "@redwoodjs/eslint-plugin-redwood".
(The package "@redwoodjs/eslint-plugin-redwood" was not found when loaded as a Node module from the directory "/Users/olance/Dev/redwood".)
It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
npm install @redwoodjs/eslint-plugin-redwood@latest --save-dev
The plugin "@redwoodjs/eslint-plugin-redwood" was referenced from the config file in "package.json » @redwoodjs/eslint-config".
If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.
The plugin was correctly installed though.
After running yarn build, then things started working properly.
I quickly talked to some people on ESLint’s Gitter room, here’s what they said in the end:
Jordan Harband @ljharb 18:29 however, it seems the real issue is that @redwoodjs/eslint-config is broken - it should have @redwoodjs/eslint-plugin-redwood listed as a peer dep, and you do have to install it as a dev dep yourself, manually.
i’d file an issue on that eslint config to make it a proper peer dep shared configs must list every plugin they use as a peer dep, it’s a limitation of the way shared configs work. which is, 10 of them, it looks like. so you have to add all 10 as dev deps to your project look at the airbnb config to see how it’s done properly
@peterp I think I heard you like configuring stuff? 😄
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:9 (9 by maintainers)
Top Related StackOverflow Question
Thanks @peterp for the research; I can try implementing your idea, I’ll let you know 😃
@olance I had a flash of inspiration this morning and fixed this.