Skip to content

Commit 6bf1b65

Browse files
Merge pull request #190 from 626-ju/React-김성주-sprint6
[김성주] sprint6
2 parents 4c79977 + fd42499 commit 6bf1b65

66 files changed

Lines changed: 3880 additions & 1495 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.prettierrc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"singleQuote": true,
3+
"endOfLine": "auto"
4+
}

eslint.config.js

Lines changed: 91 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,104 @@
1-
import js from '@eslint/js'
2-
import globals from 'globals'
3-
import reactHooks from 'eslint-plugin-react-hooks'
4-
import reactRefresh from 'eslint-plugin-react-refresh'
1+
import pluginJs from '@eslint/js';
2+
import configPrettier from 'eslint-config-prettier';
3+
import pluginImport from 'eslint-plugin-import';
4+
import pluginPrettier from 'eslint-plugin-prettier';
5+
import pluginReact from 'eslint-plugin-react';
6+
import pluginReactHooks from 'eslint-plugin-react-hooks';
7+
import globals from 'globals';
58

69
export default [
7-
{ ignores: ['dist'] },
10+
// 1. ESLint 기본 권장 규칙
11+
pluginJs.configs.recommended,
12+
13+
// 2. Prettier 설정 (ESLint와 Prettier 충돌 방지 및 Prettier 규칙 적용)
14+
configPrettier,
815
{
9-
files: ['**/*.{js,jsx}'],
16+
plugins: {
17+
prettier: pluginPrettier,
18+
},
19+
rules: {
20+
'prettier/prettier': ['error', { endOfLine: 'auto' }], // Prettier 규칙 위반 시 에러 발생
21+
},
22+
},
23+
24+
// 3. React 관련 설정
25+
{
26+
files: ['**/*.{js,jsx}'], // JavaScript 및 JSX 파일에만 적용
27+
plugins: {
28+
react: pluginReact,
29+
'react-hooks': pluginReactHooks,
30+
},
1031
languageOptions: {
11-
ecmaVersion: 2020,
12-
globals: globals.browser,
32+
ecmaVersion: 2021, // ECMAScript 버전 (ES2021)
33+
sourceType: 'module', // 모듈 사용
1334
parserOptions: {
14-
ecmaVersion: 'latest',
15-
ecmaFeatures: { jsx: true },
16-
sourceType: 'module',
35+
ecmaFeatures: {
36+
jsx: true, // JSX 지원 활성화
37+
},
38+
},
39+
// 브라우저 및 Node.js 환경 전역 변수 설정
40+
globals: {
41+
...globals.browser,
42+
...globals.node,
1743
},
1844
},
45+
settings: {
46+
react: {
47+
version: 'detect', // React 버전 자동 감지
48+
},
49+
},
50+
rules: {
51+
'quotes': ['error', 'single', { avoidEscape: true }],
52+
'react/react-in-jsx-scope': 'off', // React 17부터 JSX 변환이 자동으로 되므로 제거
53+
'react/prop-types': 'off', // JavaScript에서도 prop-types 사용 여부에 따라 설정 (여기서는 비활성화)
54+
'react/jsx-uses-react': 'off', // New JSX Transform 관련 설정
55+
'react/jsx-key': 'error', // 리스트 렌더링엔 항상 고유한 key 값 사용
56+
'react/destructuring-assignment': ['error', 'always'], // Props 전달은 비구조화 할당
57+
'no-unused-vars': ['error', { args: 'none', ignoreRestSiblings: true }], // ignoreRestSiblings: true는 객체 비구조화 할당에서 나머지가 사용되지 않아도 경고하지 않습니다.
58+
'react/jsx-uses-vars': 'error', // JSX에서 사용되는 변수를 사용된 것으로 간주
59+
'react/jsx-no-undef': 'error', // 정의되지 않은 JSX 컴포넌트 사용 방지
60+
'prefer-arrow-callback': 'error', // 콜백 함수는 화살표 함수로
61+
'func-names': ['error', 'as-needed'], // 필요한 경우에만 함수 이름 허용
62+
},
63+
},
64+
65+
// 4. import/order 플러그인 설정
66+
{
1967
plugins: {
20-
'react-hooks': reactHooks,
21-
'react-refresh': reactRefresh,
68+
import: pluginImport,
2269
},
2370
rules: {
24-
...js.configs.recommended.rules,
25-
...reactHooks.configs.recommended.rules,
26-
'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
27-
'react-refresh/only-export-components': [
28-
'warn',
29-
{ allowConstantExport: true },
71+
'import/order': [
72+
'error',
73+
{
74+
groups: [
75+
'builtin',
76+
'external',
77+
'internal',
78+
['parent', 'sibling', 'index'],
79+
'object',
80+
'type',
81+
],
82+
pathGroups: [
83+
{
84+
pattern: 'react',
85+
group: 'external',
86+
position: 'before',
87+
},
88+
{
89+
pattern: '@src/**', // 프로젝트 내 alias 설정 (예: @src/components)
90+
group: 'internal',
91+
position: 'after',
92+
},
93+
],
94+
pathGroupsExcludedImportTypes: ['react'],
95+
'newlines-between': 'never',
96+
alphabetize: {
97+
order: 'asc',
98+
caseInsensitive: true,
99+
},
100+
},
30101
],
31102
},
32103
},
33-
]
104+
];

0 commit comments

Comments
 (0)