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