2025-06-05 20:38:10 +08:00
|
|
|
import antfu from '@antfu/eslint-config'
|
|
|
|
import nextPlugin from '@next/eslint-plugin-next'
|
|
|
|
import eslintConfigPrettier from 'eslint-config-prettier'
|
|
|
|
import jsxA11y from 'eslint-plugin-jsx-a11y'
|
|
|
|
import perfectionist from 'eslint-plugin-perfectionist'
|
|
|
|
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
|
|
|
|
import unusedImports from 'eslint-plugin-unused-imports'
|
2025-03-31 19:43:56 +08:00
|
|
|
|
2025-04-30 19:50:16 +08:00
|
|
|
const config = antfu(
|
|
|
|
{
|
|
|
|
isInEditor: true,
|
|
|
|
react: true,
|
|
|
|
typescript: true,
|
|
|
|
stylistic: false,
|
|
|
|
markdown: false,
|
|
|
|
toml: false,
|
|
|
|
ignores: [
|
2025-06-05 20:38:10 +08:00
|
|
|
'public',
|
|
|
|
'node_modules',
|
|
|
|
'build',
|
|
|
|
'.history',
|
|
|
|
'.next',
|
|
|
|
'public',
|
|
|
|
'pnpm-lock.yaml',
|
|
|
|
'package-lock.json',
|
|
|
|
'next-env.d.ts',
|
2025-04-30 19:50:16 +08:00
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
2025-06-05 20:38:10 +08:00
|
|
|
files: ['**/*.{ts,tsx,js,jsx}'],
|
2025-04-30 19:50:16 +08:00
|
|
|
languageOptions: {
|
2025-06-05 20:38:10 +08:00
|
|
|
ecmaVersion: 'latest',
|
2025-03-31 19:43:56 +08:00
|
|
|
},
|
2025-04-30 19:50:16 +08:00
|
|
|
rules: {
|
2025-06-05 20:38:10 +08:00
|
|
|
'no-console': 'off',
|
|
|
|
'no-unused-vars': 'off',
|
|
|
|
'@typescript-eslint/no-unused-vars': 'off',
|
|
|
|
'ts/no-use-before-define': 'off',
|
|
|
|
'ts/strict-boolean-expressions': 'off',
|
|
|
|
'ts/no-unsafe-member-access': 'off',
|
|
|
|
'ts/no-unsafe-call': 'off',
|
|
|
|
'ts/no-unsafe-assignment': 'off',
|
|
|
|
'ts/no-unsafe-return': 'off',
|
|
|
|
'ts/no-unsafe-argument': 'off',
|
|
|
|
'ts/no-misused-promises': 'off',
|
|
|
|
'ts/no-floating-promises': 'off',
|
|
|
|
'node/prefer-global/process': 'off',
|
|
|
|
'node/prefer-global/buffer': 'off',
|
|
|
|
'import/no-named-default': 'off',
|
2025-03-31 19:43:56 +08:00
|
|
|
},
|
2025-04-30 19:50:16 +08:00
|
|
|
},
|
|
|
|
jsxA11y.flatConfigs.recommended,
|
|
|
|
{
|
|
|
|
plugins: {
|
2025-06-05 20:38:10 +08:00
|
|
|
'@next/next': nextPlugin,
|
2025-03-31 19:43:56 +08:00
|
|
|
},
|
2025-04-30 19:50:16 +08:00
|
|
|
rules: {
|
|
|
|
...nextPlugin.configs.recommended.rules,
|
2025-06-05 20:38:10 +08:00
|
|
|
...nextPlugin.configs['core-web-vitals'].rules,
|
2025-03-31 19:43:56 +08:00
|
|
|
},
|
2025-04-30 19:50:16 +08:00
|
|
|
},
|
|
|
|
{
|
2025-06-05 20:38:10 +08:00
|
|
|
name: 'perfectionist',
|
2025-04-30 19:50:16 +08:00
|
|
|
rules: {
|
2025-06-05 20:38:10 +08:00
|
|
|
'import/order': 'off',
|
|
|
|
'sort-imports': 'off',
|
|
|
|
'perfectionist/sort-imports':
|
|
|
|
perfectionist.configs['recommended-natural'].rules[
|
|
|
|
'perfectionist/sort-imports'
|
2025-04-30 19:50:16 +08:00
|
|
|
],
|
2025-06-05 20:38:10 +08:00
|
|
|
'perfectionist/sort-exports':
|
|
|
|
perfectionist.configs['recommended-natural'].rules[
|
|
|
|
'perfectionist/sort-exports'
|
2025-04-30 19:50:16 +08:00
|
|
|
],
|
2025-06-05 20:38:10 +08:00
|
|
|
'perfectionist/sort-named-imports':
|
|
|
|
perfectionist.configs['recommended-natural'].rules[
|
|
|
|
'perfectionist/sort-named-imports'
|
2025-04-30 19:50:16 +08:00
|
|
|
],
|
2025-06-05 20:38:10 +08:00
|
|
|
'perfectionist/sort-named-exports':
|
|
|
|
perfectionist.configs['recommended-natural'].rules[
|
|
|
|
'perfectionist/sort-named-exports'
|
2025-04-30 19:50:16 +08:00
|
|
|
],
|
2025-03-31 19:43:56 +08:00
|
|
|
},
|
2025-04-30 19:50:16 +08:00
|
|
|
},
|
2025-06-05 20:38:10 +08:00
|
|
|
|
2025-04-30 19:50:16 +08:00
|
|
|
{
|
|
|
|
plugins: {
|
2025-06-05 20:38:10 +08:00
|
|
|
'unused-imports': unusedImports,
|
2025-04-30 19:50:16 +08:00
|
|
|
},
|
|
|
|
rules: {
|
2025-06-05 20:38:10 +08:00
|
|
|
'unused-imports/no-unused-imports': 'error',
|
|
|
|
'unused-imports/no-unused-vars': [
|
|
|
|
'warn',
|
2025-04-30 19:50:16 +08:00
|
|
|
{
|
2025-06-05 20:38:10 +08:00
|
|
|
vars: 'all',
|
|
|
|
varsIgnorePattern: '^_',
|
|
|
|
args: 'after-used',
|
|
|
|
argsIgnorePattern: '^_',
|
2025-03-31 19:43:56 +08:00
|
|
|
},
|
2025-04-30 19:50:16 +08:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2025-06-05 20:38:10 +08:00
|
|
|
|
2025-04-30 19:50:16 +08:00
|
|
|
eslintConfigPrettier,
|
|
|
|
eslintPluginPrettierRecommended,
|
2025-06-05 20:38:10 +08:00
|
|
|
)
|
|
|
|
export default config
|