diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..c16edae --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,43 @@ +// eslint.config.js (v9 Flat Config) - 추천 설정 +import js from '@eslint/js'; +import globals from 'globals'; +import reactHooks from 'eslint-plugin-react-hooks'; +import reactRefresh from 'eslint-plugin-react-refresh'; +import unusedImports from 'eslint-plugin-unused-imports'; +import prettierConfig from 'eslint-config-prettier'; + +export default [ + { ignores: ['dist', 'node_modules'] }, + js.configs.recommended, + + { + files: ['**/*.{js,jsx}'], + languageOptions: { + ecmaVersion: 2024, + sourceType: 'module', + parserOptions: { ecmaFeatures: { jsx: true } }, + globals: { ...globals.browser }, + }, + plugins: { + 'react-hooks': reactHooks, + 'react-refresh': reactRefresh, + 'unused-imports': unusedImports, + }, + rules: { + // 코드 품질 + 'prefer-const': 'error', // 재할당 없으면 const 강제 + 'no-var': 'error', // var 금지 + eqeqeq: ['error', 'always'], // === 강제 + + // 미사용 코드 정리 + 'no-unused-vars': 'off', + 'unused-imports/no-unused-imports': 'error', // 미사용 import 자동 제거 + + // React + ...reactHooks.configs.recommended.rules, // Hooks 규칙 + 'react-refresh/only-export-components': ['warn', { allowConstantExport: true }], + }, + }, + + prettierConfig, // Prettier 충돌 방지 (반드시 마지막에) +]; \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..296fff4 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,9 @@ +{ + "semi": true, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "all", + "printWidth": 100, + "endOfLine": "lf", + "plugins": ["prettier-plugin-tailwindcss"] +} \ No newline at end of file diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..4fa125d --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,29 @@ +import js from '@eslint/js' +import globals from 'globals' +import reactHooks from 'eslint-plugin-react-hooks' +import reactRefresh from 'eslint-plugin-react-refresh' +import { defineConfig, globalIgnores } from 'eslint/config' + +export default defineConfig([ + globalIgnores(['dist']), + { + files: ['**/*.{js,jsx}'], + extends: [ + js.configs.recommended, + reactHooks.configs.flat.recommended, + reactRefresh.configs.vite, + ], + languageOptions: { + ecmaVersion: 2020, + globals: globals.browser, + parserOptions: { + ecmaVersion: 'latest', + ecmaFeatures: { jsx: true }, + sourceType: 'module', + }, + }, + rules: { + 'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }], + }, + }, +]) diff --git a/index.html b/index.html index 8715026..2d9c8d4 100644 --- a/index.html +++ b/index.html @@ -4,10 +4,11 @@ +