Last active
June 27, 2021 18:23
-
-
Save rafael-angonese/779dbc84a5a4e2a85a79b7aca32478dc to your computer and use it in GitHub Desktop.
Eslint in NEXTjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node_modules | |
.next | |
/*.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"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": {} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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