This commit is contained in:
Alex
2024-10-19 18:50:17 -04:00
parent 00d0dfa107
commit eb366f3b2e
17 changed files with 2650 additions and 385 deletions

View File

@ -1,5 +1,6 @@
import type { ReactRulesObject } from '@aet/eslint-define-config/src/rules/react';
import type { ReactRefreshRulesObject } from '@aet/eslint-define-config/src/rules/react-refresh';
import type { Linter, ESLint } from 'eslint';
import { error, off, warn } from '../constants';
import { def } from '../middleware';
@ -17,10 +18,11 @@ export async function react() {
const hooks = await import('../../packages/eslint-plugin-react-hooks');
return defineConfig([
reactPlugin.configs['recommended-type-checked'] as any,
reactPlugin.configs['recommended-type-checked'] as unknown as Linter.Config,
hooks.flatConfigs.recommended,
a11y.flatConfigs.recommended,
{
name: 'eslint-rules/react',
files: ['*.tsx'],
rules: reactRules,
},
@ -34,9 +36,9 @@ const refreshRules: Partial<ReactRefreshRulesObject> = {
export async function reactRefresh() {
const refreshPlugin = def(await import('eslint-plugin-react-refresh'));
return defineConfig({
name: 'eslint-rules/react-refresh',
plugins: {
// @ts-expect-error no types
'react-refresh': refreshPlugin,
'react-refresh': refreshPlugin as unknown as ESLint.Plugin,
},
rules: refreshRules,
});