Closed jmealo closed 4 years ago
This Action depends on your project having eslint
as a dev dependency. If npm install
doesn't install eslint
then it won't work.
Quick followup -- if a monorepo doens't have a package.json in its root, will code needed to be added to accomodate this? Also, would you be willing to accept a PR for adding a working-directory
key? Thanks! :)
That's a valid case but I think pretty outside the norm. The best solution in that case, in my opinion, would be to set up your dependencies as part of your GitHub Action workflow. As a bonus, GitHub's Node actions are pretty good about caching your dependencies so this should run pretty fast.
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 12
- name: Install Node.js dependencies
run: |
cd {YOUR_WORKING_DIRECTORY}
npm install
I'm planning to rewrite this Action as a workflow command (#21) so I'm not sure a PR would be worth it
Ok, thanks @hallee! Makes sense :)
@hallee: Thanks for the suggestions. I already use setup node, run npm install
and have eslint
as a dependency. I use this at the top of my workflow:
defaults:
run:
shell: bash
working-directory: backend
If your package.json isn't in the root (or if you don't include eslint or run npm install
) eslint
will not be found in this action.
It might be helpful to add something to the documentation that mono repos aren't supported.
@hallee The eslint
need to at dependencies
or devDependencies
? I have eslint
at devDependencies
but I still got this error
@hallee any info?
Hello, I followed the instructions and am getting an error that
eslint
cannot be found.Actions Workflow:
.eslintrc.js:
Output: