Files
nice-app-web/eslint.config.ts
focp212@naver.com 05238b04c1 첫 커밋
2025-09-05 15:36:48 +09:00

139 lines
3.7 KiB
TypeScript

import js from '@eslint/js'
import typescript from '@typescript-eslint/eslint-plugin'
import typescriptParser from '@typescript-eslint/parser'
import react from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
const config = [
js.configs.recommended,
{
files: ['**/*.{js,jsx}'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
// Browser globals
console: 'readonly',
document: 'readonly',
window: 'readonly',
localStorage: 'readonly',
sessionStorage: 'readonly',
navigator: 'readonly',
alert: 'readonly',
confirm: 'readonly',
setTimeout: 'readonly',
clearTimeout: 'readonly',
setInterval: 'readonly',
clearInterval: 'readonly',
atob: 'readonly',
btoa: 'readonly',
requestAnimationFrame: 'readonly',
cancelAnimationFrame: 'readonly',
// Node.js globals for build tools
__dirname: 'readonly',
__filename: 'readonly',
process: 'readonly',
// TypeScript globals
NodeJS: 'readonly',
React: 'readonly',
},
},
plugins: {
react,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...react.configs.recommended.rules,
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
settings: {
react: { version: '18.2' },
},
},
{
files: ['src/**/*.{ts,tsx}'],
languageOptions: {
parser: typescriptParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: './tsconfig.json',
},
globals: {
// Browser globals
console: 'readonly',
document: 'readonly',
window: 'readonly',
localStorage: 'readonly',
sessionStorage: 'readonly',
navigator: 'readonly',
alert: 'readonly',
confirm: 'readonly',
setTimeout: 'readonly',
clearTimeout: 'readonly',
setInterval: 'readonly',
clearInterval: 'readonly',
atob: 'readonly',
btoa: 'readonly',
requestAnimationFrame: 'readonly',
cancelAnimationFrame: 'readonly',
// Node.js globals for build tools
__dirname: 'readonly',
__filename: 'readonly',
process: 'readonly',
// TypeScript globals
NodeJS: 'readonly',
React: 'readonly',
},
},
plugins: {
'@typescript-eslint': typescript,
react,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...typescript.configs.recommended.rules,
...react.configs.recommended.rules,
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-explicit-any': 'warn',
'react/react-in-jsx-scope': 'off', // React 17+에서는 불필요
},
settings: {
react: { version: '18.2' },
},
},
{
files: ['*.config.{js,ts}', 'eslint.config.ts'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
console: 'readonly',
process: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
},
},
rules: {
'@typescript-eslint/no-unused-vars': 'off',
'no-unused-vars': 'off',
},
},
{
ignores: ['dist', 'node_modules', '*.config.js', 'tailwind.config.ts'],
},
]
export default config