최근 프로젝트에서
lint와 prettier 설정할 일이 꽤 있었는데
하나로 통일시키면 좋겠다고 생각해서
기록으로 남기려한다.
npm install -D --dev eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-jsx-a11y prettier eslint-plugin-prettier eslint-config-prettier eslint-plugin-simple-import-sort
.eslintrc.js
module.exports = {
root: true,
env: {
browser: true,
amd: true,
node: true,
},
parserOptions: {
ecmaVersion: 6,
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
settings: {
react: {
version: "detect",
},
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:jsx-a11y/recommended",
"plugin:prettier/recommended",
],
plugins: ["simple-import-sort"],
rules: {
"prettier/prettier": ["error", {}, { usePrettierrc: true }],
"react/prop-types": "off",
"react/react-in-jsx-scope": "off",
"jsx-a11y/anchor-is-valid": "off",
"@typescript-eslint/no-unused-vars": ["error"],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"react/no-unescaped-entities": "off",
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-namespace": "off",
},
overrides: [
{
files: ["**/*.ts", "**/*.tsx"],
parser: "@typescript-eslint/parser",
},
],
};
.prettierrc
{
"semi": true,
"tabWidth": 2,
"printWidth": 100,
"singleQuote": false,
"trailingComma": "all",
"jsxBracketSameLine": true,
"endOfLine": "auto"
}
군더더기없이 깔끔한 것 같다.
반응형
'환경설정' 카테고리의 다른 글
Craco로 emotion css prop 및 절대경로 config 세팅 (2) (9) | 2023.04.20 |
---|---|
Craco로 emotion css prop 및 절대경로 config 세팅 (1) (0) | 2023.04.16 |
webpack 환경변수 주입하기 (feat.Typescript) (0) | 2023.03.15 |
webpack으로 세팅한 프로젝트에 EmotionJS 설치하기 (0) | 2023.03.14 |