mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-12-01 01:05:30 +08:00
48 lines
1.4 KiB
JavaScript
48 lines
1.4 KiB
JavaScript
import { defineConfig } from 'eslint/config'
|
|
import tseslint from '@electron-toolkit/eslint-config-ts'
|
|
import eslintConfigPrettier from '@electron-toolkit/eslint-config-prettier'
|
|
import eslintPluginReact from 'eslint-plugin-react'
|
|
import eslintPluginReactHooks from 'eslint-plugin-react-hooks'
|
|
import eslintPluginReactRefresh from 'eslint-plugin-react-refresh'
|
|
|
|
export default defineConfig(
|
|
{ ignores: ['**/node_modules', '**/dist', '**/out'] },
|
|
tseslint.configs.recommended,
|
|
eslintPluginReact.configs.flat.recommended,
|
|
eslintPluginReact.configs.flat['jsx-runtime'],
|
|
{
|
|
settings: {
|
|
react: {
|
|
version: 'detect'
|
|
}
|
|
}
|
|
},
|
|
{
|
|
files: ['**/*.{ts,tsx}'],
|
|
plugins: {
|
|
'react-hooks': eslintPluginReactHooks,
|
|
'react-refresh': eslintPluginReactRefresh
|
|
},
|
|
rules: {
|
|
'prettier/prettier': [
|
|
'error',
|
|
{
|
|
endOfLine: 'auto'
|
|
}
|
|
],
|
|
...eslintPluginReactHooks.configs.recommended.rules,
|
|
...eslintPluginReactRefresh.configs.vite.rules
|
|
}
|
|
},
|
|
{
|
|
// 扩展示例是给第三方作者抄的 CommonJS,不是 TS 源码:
|
|
// 返回类型/require 规则在这里没有意义,强制它们只会让示例变成反例。
|
|
files: ['examples/**/*.{js,mjs}'],
|
|
rules: {
|
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
'@typescript-eslint/no-require-imports': 'off'
|
|
}
|
|
},
|
|
eslintConfigPrettier
|
|
)
|