yarn add --dev @typescript-eslint/eslint-plugin
// .eslintrc.json
{
"plugins": ["@typescript-eslint"],
"extends": [
"next/core-web-vitals",
"plugin:@typescript-eslint/recommended"
],
"rules": {
// I suggest you add those two rules:
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-explicit-any": "error"
}
}
Prettier
코딩 스타일 지정
yarn add --dev prettier eslint-config-prettier
// .prettierrc.json
{
"semi": true,
"trailingComma": "es5",
"singleQuote": true,
"tabWidth": 2,
"useTabs": false
}
// .eslintrc.json
{
// ...
"extends": [
"next/core-web-vitals",
"plugin:@typescript-eslint/recommended",
"prettier" // Add "prettier" last. This will turn off eslint rules conflicting with prettier. This is not what will format our code.
],
// ...
}