Update
This commit is contained in:
@ -1,14 +1,14 @@
|
||||
import type { Middleware } from '../index';
|
||||
import type { ReactRulesObject } from '@aet/eslint-define-config/src/rules/react';
|
||||
import type { ReactRefreshRulesObject } from '@aet/eslint-define-config/src/rules/react-refresh';
|
||||
import { error, off, warn } from '../constants';
|
||||
import { ReactRulesObject } from '@aet/eslint-define-config/src/rules/react';
|
||||
import { ReactRefreshRulesObject } from '@aet/eslint-define-config/src/rules/react-refresh';
|
||||
import { defineMiddleware } from '../middleware';
|
||||
|
||||
const reactRules: Partial<ReactRulesObject> = {
|
||||
'@eslint-react/no-missing-component-display-name': off,
|
||||
'@eslint-react/no-children-prop': error,
|
||||
};
|
||||
|
||||
export const react: Middleware = (config, { addRules }) => {
|
||||
export const react = defineMiddleware((config, { addRules }) => {
|
||||
config.plugins.push('@eslint-react/eslint-plugin', 'react-hooks');
|
||||
config.extends.push(
|
||||
'plugin:@eslint-react/recommended-legacy',
|
||||
@ -23,13 +23,13 @@ export const react: Middleware = (config, { addRules }) => {
|
||||
},
|
||||
});
|
||||
addRules(reactRules);
|
||||
};
|
||||
});
|
||||
|
||||
const refreshRules: Partial<ReactRefreshRulesObject> = {
|
||||
'react-refresh/only-export-components': [warn, { allowConstantExport: true }],
|
||||
};
|
||||
|
||||
export const reactRefresh: Middleware = (config, { addRules }) => {
|
||||
export const reactRefresh = defineMiddleware((config, { addRules }) => {
|
||||
config.plugins.push('react-refresh');
|
||||
addRules(refreshRules);
|
||||
};
|
||||
});
|
||||
|
Reference in New Issue
Block a user