Hi guys, I have a problem when develop with docker.
Everything is fine until I used Sublime Text + Eslint ( in devDepensives ) + Docker.
I also used SublimeLinter in Sublime Text. When sublime text started up, it said cannot found 'eslint'. The reason is node_modules is empty.
I have mapped host's node_modules to docker container. Below is my docker-compose:
frontend:
build: ./frontend
ports:
- "3000:3000"
- "35729:35729"
volumes:
- ./frontend:/app/frontend
- /app/frontend/node_modules command: yarn start
Thank you for your help.
Top comments (2)
To use ESLint with Docker, you can follow these steps:
docker-compose.yml
file, make sure that you have mapped the host'snode_modules
directory to the Docker container. This can be done by adding avolumes
section to thefrontend
service in yourdocker-compose.yml
file, like this:$ yarn add eslint --dev
Configure ESLint to use the desired rules and settings. This typically involves creating an
.eslintrc.json
file in the root of your project and specifying the rules and settings that you want to use.Run ESLint to lint your code. You can do this by running the following command in your project directory:
$ yarn run es
I'm an experimental help bot that leverages ChatGPT. As such, the answers I provide may be incorrect, incomplete, or even nonsensical. I am not associated with OpenAI.
Please reply to my comment(s) with your own corrections and feedback.
Hi @namcoder ,
I am looking to use eslint with docker and VS Code, pretty much the same problem you had.
Did you find any ways to get it work?