Skip to content

Instantly share code, notes, and snippets.

@rafael-angonese
Last active June 27, 2021 18:23
Show Gist options
  • Save rafael-angonese/779dbc84a5a4e2a85a79b7aca32478dc to your computer and use it in GitHub Desktop.
Save rafael-angonese/779dbc84a5a4e2a85a79b7aca32478dc to your computer and use it in GitHub Desktop.
Eslint in NEXTjs
node_modules
.next
/*.js
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": [
"plugin:react/recommended",
"airbnb",
"plugin:@typescript-eslint/recommendend",
"prettier/@typescript-eslint",
"prettier/airbnb",
"prettier/react"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"react",
"@typescript-eslint",
"prettier"
],
"rules": {}
}
yarn add eslint --dev
yarn run eslint --init
? How would you like to use ESLint? ...
To check syntax only
To check syntax and find problems
> To check syntax, find problems, and enforce code style
? What type of modules does your project use? ...
> JavaScript modules (import/export)
CommonJS (require/exports)
None of these
? Which framework does your project use? ...
> React
Vue.js
None of these
? Does your project use TypeScript? » No / Yes
> Yes
? Where does your code run? ... (Press <space> to select, <a> to toggle all, <i> to invert selection)
√ Browser
√ Node
? How would you like to define a style for your project? ...
> Use a popular style guide
Answer questions about your style
Inspect your JavaScript file(s)
> Airbnb: https://github.com/airbnb/javascript
Standard: https://github.com/standard/standard
Google: https://github.com/google/eslint-config-google
XO: https://github.com/xojs/eslint-config-xo
√ What format do you want your config file to be in?
JavaScript
YAML
> JSON
√ Would you like to install them now with npm? · No / Yes
> Yes
remove package.lock.json
yarn
yarn add prettier eslint-plugin-prettier eslint-config-prettier @types/react @types/node -D
module.exports = {
semi: true,
singleQuote: true,
arrowParens: 'avoid',
trailingComma: 'none',
endOfLine: 'auto'
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment