반응형
.prettierrc
{
"singleQuote": true,
"semi": true,
"useTabs": false,
"tabWidth": 2,
"trailingComma": "all",
"printWidth": 80,
"bracketSpacing": true,
"endOfLine": "auto"
}
.eslintrc.js
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin', 'import', 'prettier'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'no-console': 'warn',
'prettier/prettier': 'error',
'import/order': [
'error',
{
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
],
pathGroups: [
{
pattern: 'react',
group: 'external',
position: 'before',
},
// 필요에 따라 더 많은 패턴을 추가
],
pathGroupsExcludedImportTypes: ['builtin'],
'newlines-between': 'always',
alphabetize: {
order: 'asc' /* 오름차순 정렬. 옵션: ['ignore', 'asc', 'desc'] */,
caseInsensitive: true,
},
},
],
},
};
VSCode settings.json
- Editor: Code Actions On Save 활성화
// settings.json
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
ESLint CLI로 자동 수정 실행
npx eslint --fix "src/**/*.ts"반응형
'내일배움캠프 > TIL' 카테고리의 다른 글
| [CloudFlare images] NestJS에서 CloudFlare로 이미지 저장 (1) | 2024.01.06 |
|---|---|
| [GIT & CI/CD] 포크한 퍼블릭 레포지토리를 프라이빗으로 전환 (1) | 2024.01.06 |
| NPM 모듈 업데이트 (0) | 2024.01.02 |
| 동적 라우트 에러 (1) | 2023.12.30 |
| Redis Cloud 연결 (0) | 2023.12.28 |
