Update
This commit is contained in:
parent
574ff427d1
commit
aeb69e38dc
23
src/index.ts
23
src/index.ts
@ -3,14 +3,18 @@ import type { ESLintConfig } from 'eslint-define-config';
|
||||
// @ts-expect-error
|
||||
const { name } = (0, require)('./package.json');
|
||||
|
||||
function unique<T>(arr: T[]): T[] {
|
||||
return [...new Set(arr)];
|
||||
}
|
||||
const unique = <T>(arr: T[]): T[] => [...new Set(arr)];
|
||||
|
||||
const error = 'error';
|
||||
const warn = 'warn';
|
||||
const off = 'off';
|
||||
|
||||
declare module 'eslint-define-config/src/rules/react/no-unknown-property.d.ts' {
|
||||
export interface NoUnknownPropertyOption {
|
||||
extends: ('next' | 'emotion')[];
|
||||
}
|
||||
}
|
||||
|
||||
export function extendConfig({
|
||||
plugins,
|
||||
settings,
|
||||
@ -93,12 +97,13 @@ export function extendConfig({
|
||||
'@typescript-eslint/no-empty-interface': [error, { allowSingleExtends: true }],
|
||||
'@typescript-eslint/no-explicit-any': off,
|
||||
'@typescript-eslint/no-extraneous-class': error,
|
||||
'@typescript-eslint/no-misused-promises': [error, { checksVoidReturn: false }],
|
||||
'@typescript-eslint/no-namespace': off,
|
||||
'@typescript-eslint/no-unnecessary-type-assertion': error,
|
||||
'@typescript-eslint/no-unsafe-argument': off,
|
||||
'@typescript-eslint/no-unsafe-assignment': off,
|
||||
'@typescript-eslint/no-unsafe-member-access': off,
|
||||
'@typescript-eslint/no-unsafe-call': off,
|
||||
'@typescript-eslint/no-unsafe-member-access': off,
|
||||
'@typescript-eslint/no-unsafe-return': off,
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
error,
|
||||
@ -137,7 +142,7 @@ export function extendConfig({
|
||||
'prefer-rest-params': warn,
|
||||
'prefer-spread': warn,
|
||||
'quote-props': [error, 'as-needed'],
|
||||
'spaced-comment': [error, 'always', { markers: ['/'] }],
|
||||
'spaced-comment': [error, 'always', { markers: ['/', '#', '@'] }],
|
||||
'sort-imports': [warn, { ignoreDeclarationSort: true }],
|
||||
yoda: [error, 'never', { exceptRange: true }],
|
||||
...(hasReact
|
||||
@ -146,7 +151,7 @@ export function extendConfig({
|
||||
'react/no-children-prop': error,
|
||||
'react/prop-types': off,
|
||||
'react/react-in-jsx-scope': off,
|
||||
'react/no-unknown-property': [error, { ignore: ['css'] }],
|
||||
'react/no-unknown-property': [error, { extends: ['emotion'] }],
|
||||
}
|
||||
: {}),
|
||||
...(hasUnicorn
|
||||
@ -171,10 +176,7 @@ export function extendConfig({
|
||||
: {}),
|
||||
...(hasReactRefresh
|
||||
? {
|
||||
'react-refresh/only-export-components': [
|
||||
'warn',
|
||||
{ allowConstantExport: true },
|
||||
],
|
||||
'react-refresh/only-export-components': [warn, { allowConstantExport: true }],
|
||||
}
|
||||
: {}),
|
||||
...rules,
|
||||
@ -194,6 +196,7 @@ const _resolveFilename = (Module as any)._resolveFilename;
|
||||
case 'eslint-plugin-react':
|
||||
case 'eslint-plugin-react-hooks':
|
||||
case 'eslint-plugin-rules':
|
||||
case 'eslint-plugin-n':
|
||||
module = `${name}/${module.slice(14)}`;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user