Linting #15503
-
Hi everyone, Does Next.js require any additional config in order to get eslint to work? I init an eslint config file (airbnb and react-hooks) at the root folder of my project but it wasn't working. I have always used create-react-app and these lintings come out of the box so not exactly sure I was doing it right either. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Where are you wanting to see the lint output? In your terminal? Or in your editor (i.e. Visual Studio Code)? Or lint it manually by running a command? If you want the lint errors to show in your terminal, you need to use something like
module.exports = {
webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
if (dev) {
config.module.rules.push({
test: /\.(j|t)s?$/,
exclude: /node_modules/,
loader: 'eslint-loader',
})
}
return config
},
} |
Beta Was this translation helpful? Give feedback.
Where are you wanting to see the lint output? In your terminal? Or in your editor (i.e. Visual Studio Code)? Or lint it manually by running a command?
If you want the lint errors to show in your terminal, you need to use something like
eslint-loader
similar to how it is done in this issue #9904next.config.js