Update
This commit is contained in:
@ -4,6 +4,8 @@ import type { ESLintConfig } from 'eslint-define-config';
|
||||
const { name } = (0, require)('./package.json');
|
||||
|
||||
const unique = <T>(arr: T[]): T[] => [...new Set(arr)];
|
||||
const ensureArray = <T>(value?: T | T[]): T[] =>
|
||||
value == null ? [] : Array.isArray(value) ? value : [value];
|
||||
|
||||
const error = 'error';
|
||||
const warn = 'warn';
|
||||
@ -25,6 +27,7 @@ export function extendConfig({
|
||||
const hasReact = plugins?.includes('react');
|
||||
const hasUnicorn = plugins?.includes('unicorn');
|
||||
const hasReactRefresh = plugins?.includes('react-refresh');
|
||||
const hasNext = ensureArray(_extends).some(name => name.includes(':@next/next'));
|
||||
|
||||
const result: ESLintConfig = {
|
||||
root: true,
|
||||
@ -151,7 +154,10 @@ export function extendConfig({
|
||||
'react/no-children-prop': error,
|
||||
'react/prop-types': off,
|
||||
'react/react-in-jsx-scope': off,
|
||||
'react/no-unknown-property': [error, { extends: ['emotion'] }],
|
||||
'react/no-unknown-property': [
|
||||
error,
|
||||
{ extends: hasNext ? ['emotion', 'next'] : ['emotion'] },
|
||||
],
|
||||
}
|
||||
: {}),
|
||||
...(hasUnicorn
|
||||
|
Reference in New Issue
Block a user