Is it possible to show eslint messages in the browser console and terminal on update using dev?
Answered
Scale parasitoid posted this in #help-forum
Scale parasitoidOP
Is there a way to get lint messages in the terminal when updating a
I've attempted to use:
-
-
My IDE shows code linting hint and if I run
I appreciate any help and also realize that this feature may not be avalible through
.tsx or .js file using create-next-app with TypeScript, and ESLint . It would be nice to see lint messages in the web browser console as well. After configuring .eslintrc.json I'm able to see lint messages running npm run lint, but I'm having trouble finding a way to get lint logs on file update and/or displayed in the browser console.I've attempted to use:
-
npx create-next-app my-next-app-
npx create-next-app@v14.3.0-canary.68 my-next-canary-app.eslintrc.json{
"extends": [
"next",
"next/core-web-vitals",
"eslint:recommended",
"plugin:react/recommended",
"plugin:jsx-a11y/recommended"
],
"settings": {
"next": {
"rootDir": "packages/web-app/"
}
},
"plugins": ["jsx-a11y"],
"rules": {
"no-unused-vars": ["warn"],
"react/no-unescaped-entities": 0
}
}My IDE shows code linting hint and if I run
npm run lint I get linting warnings so I know the linting is working:./src/app/page.tsx
6:9 Warning: 'hey' is assigned a value but never used. no-unused-varsI appreciate any help and also realize that this feature may not be avalible through
next.js.Answered by joulev
nope, the dev server does not run any code quality checking processes. it doesnt run the ts type checker as well as lint servers. and no, you can't force it to do that even if you want to
4 Replies
@Scale parasitoid Is there a way to get **lint messages in the terminal** when updating a `.tsx` or `.js` file using `create-next-app` with TypeScript, and ESLint . It would be nice to see **lint messages in the web browser console** as well. After configuring `.eslintrc.json` I'm able to see lint messages running `npm run lint`, but I'm having trouble finding a way to get lint logs on file update and/or displayed in the browser console.
I've attempted to use:
- `npx create-next-app my-next-app`
- `npx create-next-app@v14.3.0-canary.68 my-next-canary-app`
`.eslintrc.json`
{
"extends": [
"next",
"next/core-web-vitals",
"eslint:recommended",
"plugin:react/recommended",
"plugin:jsx-a11y/recommended"
],
"settings": {
"next": {
"rootDir": "packages/web-app/"
}
},
"plugins": ["jsx-a11y"],
"rules": {
"no-unused-vars": ["warn"],
"react/no-unescaped-entities": 0
}
}
My IDE shows code linting hint and if I run `npm run lint` I get linting warnings so I know the linting is working:
./src/app/page.tsx
6:9 Warning: 'hey' is assigned a value but never used. no-unused-vars
I appreciate any help and also realize that this feature may not be avalible through `next.js`.
nope, the dev server does not run any code quality checking processes. it doesnt run the ts type checker as well as lint servers. and no, you can't force it to do that even if you want to
Answer
just use an editor extension like
usernamehw.errorlens for vscodeName: Error Lens
Id: usernamehw.errorlens
Description: Improve highlighting of errors, warnings and other language diagnostics.
Version: 3.17.0
Publisher: Alexander
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=usernamehw.errorlens
Id: usernamehw.errorlens
Description: Improve highlighting of errors, warnings and other language diagnostics.
Version: 3.17.0
Publisher: Alexander
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=usernamehw.errorlens
Scale parasitoidOP
Ok THANK YOU @joulev. I've been going nutzo trying to get this going, which makes sense being that it's not possible. I use IntelliJ/Webstorm and setting the
Preferences | Languages & Frameworks | JavaScript | Code Quality Tools | ESLint to Automatic ESLint configuration get's the IDE going incase someone needs to know.