eslint ์ค์
airbnb๋ฃฐ์ ๋ฐ๋ฅด๊ธฐ๋ก ํ๋ค.
yarn add -D eslint-config-airbnb eslint-config-airbnb-typescript
yarn add -D eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooks @typescript-eslint/eslint-plugin
yarn add -D @typescript-eslint/parser
yarn add -D prettier eslint-config-prettier eslint-plugin-prettier
์ ๊ฐ์ด ์ค์น๋ฅผ ์งํํ,
{
"env": {
"browser": true,
"es6": true
},
"extends": [
"next/core-web-vitals",
"airbnb",
"airbnb/hooks",
"airbnb-typescript",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"parserOptions": {
"project": "./tsconfig.json"
},
"plugins": ["react", "@typescript-eslint"],
"rules": {
"linebreak-style": "off",
"react/react-in-jsx-scope": "off"
}
}
์์ ๊ฐ์ด eslint ์ค์ ์ ํ์๋ค. airbnb์ default๋ก ๋ค์ด์๋ react๊ด๋ จ ๋ฃฐ์ ๋ ๋ฃฐ์ ์ถ๊ฐํ๊ณ ์ถ์ด์ plugin:react/recommended๋ฅผ ์ถ๊ฐํ๋ค. typescript๋ ๋ง์ฐฌ๊ฐ์ง์ด๋ค.