mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-04 19:41:02 +08:00
82 lines
2.1 KiB
JavaScript
82 lines
2.1 KiB
JavaScript
import js from '@eslint/js'
|
|
import tseslint from '@typescript-eslint/eslint-plugin'
|
|
import tsparser from '@typescript-eslint/parser'
|
|
import react from 'eslint-plugin-react'
|
|
import reactHooks from 'eslint-plugin-react-hooks'
|
|
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
import prettier from 'eslint-plugin-prettier'
|
|
|
|
export default [
|
|
{
|
|
ignores: ['dist', 'node_modules', 'build', '*.config.js']
|
|
},
|
|
js.configs.recommended,
|
|
{
|
|
files: ['**/*.{ts,tsx}'],
|
|
languageOptions: {
|
|
parser: tsparser,
|
|
parserOptions: {
|
|
ecmaVersion: 'latest',
|
|
sourceType: 'module',
|
|
ecmaFeatures: {
|
|
jsx: true
|
|
}
|
|
},
|
|
globals: {
|
|
window: 'readonly',
|
|
document: 'readonly',
|
|
console: 'readonly',
|
|
setTimeout: 'readonly',
|
|
clearTimeout: 'readonly',
|
|
setInterval: 'readonly',
|
|
clearInterval: 'readonly',
|
|
fetch: 'readonly',
|
|
localStorage: 'readonly',
|
|
sessionStorage: 'readonly'
|
|
}
|
|
},
|
|
plugins: {
|
|
'@typescript-eslint': tseslint,
|
|
'react': react,
|
|
'react-hooks': reactHooks,
|
|
'react-refresh': reactRefresh,
|
|
'prettier': prettier
|
|
},
|
|
rules: {
|
|
...tseslint.configs.recommended.rules,
|
|
...react.configs.recommended.rules,
|
|
...reactHooks.configs.recommended.rules,
|
|
|
|
// Prettier integration
|
|
'prettier/prettier': 'error',
|
|
|
|
// React rules
|
|
'react/react-in-jsx-scope': 'off',
|
|
'react/prop-types': 'off',
|
|
|
|
// TypeScript rules
|
|
'@typescript-eslint/no-explicit-any': 'warn',
|
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
'@typescript-eslint/no-unused-vars': ['warn', {
|
|
argsIgnorePattern: '^_',
|
|
varsIgnorePattern: '^_'
|
|
}],
|
|
|
|
// React Refresh
|
|
'react-refresh/only-export-components': [
|
|
'warn',
|
|
{ allowConstantExport: true }
|
|
],
|
|
|
|
// General rules
|
|
'no-console': ['warn', { allow: ['warn', 'error'] }],
|
|
'no-debugger': 'warn'
|
|
},
|
|
settings: {
|
|
react: {
|
|
version: 'detect'
|
|
}
|
|
}
|
|
}
|
|
]
|