Skip to content

Commit e6c2fce

Browse files
Merge pull request #233 from Lim-JaeEun/React-임재은-sprint6
[임재은] Sprint6
2 parents d7bbd4b + a91cc4a commit e6c2fce

25 files changed

Lines changed: 3474 additions & 935 deletions

.prettierrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true,
4+
"jsxSingleQuote": true,
5+
"tabWidth": 2,
6+
"useTabs": false,
7+
"trailingComma": "all",
8+
"arrowParens": "avoid",
9+
"printWidth": 80,
10+
"vueIndentScriptAndStyle": true,
11+
"bracketSameLine": false,
12+
"bracketSpacing": true,
13+
"endOfLine": "lf"
14+
}

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+
// eslint.config.js
2+
import pluginJs from '@eslint/js';
3+
import configPrettier from 'eslint-config-prettier';
4+
import pluginImport from 'eslint-plugin-import';
5+
import pluginPrettier from 'eslint-plugin-prettier';
6+
import pluginReact from 'eslint-plugin-react';
7+
import pluginReactHooks from 'eslint-plugin-react-hooks';
8+
import globals from 'globals';
59

610
export default [
7-
{ ignores: ['dist'] },
11+
// 1. ESLint 기본 권장 규칙
12+
pluginJs.configs.recommended,
13+
14+
// 2. Prettier 설정 (ESLint와 Prettier 충돌 방지 및 Prettier 규칙 적용)
15+
configPrettier,
816
{
9-
files: ['**/*.{js,jsx}'],
17+
plugins: {
18+
prettier: pluginPrettier,
19+
},
20+
rules: {
21+
'prettier/prettier': ['error', { endOfLine: 'auto' }], // Prettier 규칙 위반 시 에러 발생
22+
},
23+
},
24+
25+
// 3. React 관련 설정
26+
{
27+
files: ['**/*.{js,jsx}'], // JavaScript 및 JSX 파일에만 적용
28+
plugins: {
29+
react: pluginReact,
30+
'react-hooks': pluginReactHooks,
31+
},
1032
languageOptions: {
11-
ecmaVersion: 2020,
12-
globals: globals.browser,
33+
ecmaVersion: 2021, // ECMAScript 버전 (ES2021)
34+
sourceType: 'module', // 모듈 사용
1335
parserOptions: {
14-
ecmaVersion: 'latest',
15-
ecmaFeatures: { jsx: true },
16-
sourceType: 'module',
36+
ecmaFeatures: {
37+
jsx: true, // JSX 지원 활성화
38+
},
39+
},
40+
// 브라우저 및 Node.js 환경 전역 변수 설정
41+
globals: {
42+
...globals.browser,
43+
...globals.node,
1744
},
1845
},
46+
settings: {
47+
react: {
48+
version: 'detect', // React 버전 자동 감지
49+
},
50+
},
51+
rules: {
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': 'always',
96+
alphabetize: {
97+
order: 'asc',
98+
caseInsensitive: true,
99+
},
100+
},
30101
],
31102
},
32103
},
33-
]
104+
];

0 commit comments

Comments
 (0)