Skip to content

Instantly share code, notes, and snippets.

@ozluy
Last active April 10, 2022 05:16
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ozluy/f275df3d5f9eb0897a46e53d8d1ada8f to your computer and use it in GitHub Desktop.
Nextjs Eslint
//.eslintrc
{
"env": {
"browser": true,
"es6": true,
"commonjs": true
},
"plugins": ["react"],
"extends": [
"eslint:recommended",
"plugin:react/recommended"
],
"settings": {
"import/resolver": {
"node": {
"paths": ["./"]
}
}
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"experimentalObjectRestSpread": true,
"modules": true
}
},
"rules": {
"react/prefer-stateless-function": 0,
"linebreak-style": 0,
"jsx-a11y/heading-has-content": 0,
"jsx-a11y/href-no-hash": 0,
"jsx-a11y/anchor-is-valid": 0,
"no-underscore-dangle": 0,
"react/no-find-dom-node": 0,
"react/prop-types": 0,
"no-nested-ternary": 0
}
}
// next.config.js
/* eslint-disable */
const path = require('path')
module.exports = ({
exportPathMap: async function(defaultPathMap) {
return {
'/': { page: '/' },
'/about-us': { page: '/about-us' },
'/contact-us': { page: '/contact-us' },
}
},
webpack(config, { dev }) {
if (dev) {
config.module.rules.push({
test: /\.js$/,
loader: 'eslint-loader',
exclude: ['/node_modules/', '/.next/', '/out/'],
enforce: 'pre',
options: {
emitWarning: true,
},
})
}
return config
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment