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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
olancecommented, Apr 13, 2020

Thanks @peterp for the research; I can try implementing your idea, I’ll let you know 😃

1reaction
peterpcommented, Apr 18, 2020

@olance I had a flash of inspiration this morning and fixed this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

error Command failed with exit code 1. when I try to run yarn
what you need to do is just simple: follow these steps: rm -rf node_modules; yarn cache clean; yarn; yarn start.
Read more >
Error Codes | Yarn - Package Manager
This error means that this process failed and Yarn cannot successfully figure out which version of the package should be added to your...
Read more >
`yarn run start` doesn't work if you haven't run `yarn ... - GitHub
A build gets nullified by the yarn start command, because it runs clean on the full dist, then runs the build:esm to build...
Read more >
7 Github Actions Tricks I Wish I Knew Before I Started
Here are 7 tricks with github actions that changed my life (or at least my CI/CD pipeline). These tricks helped me create a...
Read more >
How to Automate Code Linting in Next.js with ESLint & Husky ...
js, it currently only runs at build time via next build . That means if you don't manually run the command, you run...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found