Next.js Discord

Discord Forum

Run elint in dev server

Unanswered
Oriental Scops-Owl posted this in #help-forum
Open in Discord
Oriental Scops-OwlOP
What is the best approach to run eslint in the dev server so it checks for linting with hot reloading?

basically i want to run the dev server and have the eslint errors show in console while dev server runs.

i tried eslint-webpack-plugin but its lacking, as it does not seem to read my eslint config and provides minimal output compared to next lint command

i dont want to have t run the lint command everytime i want to see the errors/warnings

11 Replies

Typically eslint is runned by IDE of your choice (VSCode/jetBrains etc.), there is no need to run it additionally in watch mode parallel with dev-server, as you get all errors during coding. Maybe you are missing an extension to your IDE? 😄 Let me know if that solves your issues, if you will run into trouble with that, let me know what IDE are you using 😄
Oriental Scops-OwlOP
My goal is to have it show in my dev-server for all errors
I am using vs code. i want to actively see the errors and warnings while dev server runs. this is how i have all of my vanilla react apps set up
i dont want to have to run lint command everytime i want to see a report
the webpack plugin works for what i want, but it is not detecting all of the defined eslint rules
ahhh i see whats going on with the webpack plugin
the point of eslint is that, you don't have need to run command, you just need to configure well your IDE, after that it will show you errors real-time
Oriental Scops-OwlOP
it is detecting errors on the current page that is being built
the same errors show inside of next lint command. seems like it just only detects the errors for the current page being loaded
how do you have vscode set up to run eslint on changes?
https://www.franciscomoretti.com/blog/how-to-set-up-prettier-and-eslint-in-vs-code-for-next-js

this article should help you, not sure if vscode shows project's errors or only opened-file, as I'm mainly using IDEA from jetBrains (where it's working)