Files
upstream-mirror bcf6ef63ad
Some checks failed
📦 Build / build (push) Has been cancelled
🧪 CI Test / test shard (1/4) (push) Has been cancelled
🧪 CI Test / test shard (2/4) (push) Has been cancelled
🧪 CI Test / test shard (3/4) (push) Has been cancelled
🧪 CI Test / test shard (4/4) (push) Has been cancelled
🧪 CI Test / test (push) Has been cancelled
🧪 CI Test / eslint (push) Has been cancelled
🧪 CI Test / typecheck (push) Has been cancelled
🔫 Sync to Pro / dispatch-sync (push) Has been cancelled
🔮 Sync Mirror / sync (push) Has been cancelled
snapshot of https://github.com/dream-num/univer.git (dev, 2026-09-16; blobs > 131072B omitted)
2026-09-16 05:09:45 +05:00

81 lines
2.0 KiB
TypeScript

import type { Rules } from '@antfu/eslint-config';
import type { ESLint, Linter } from 'eslint';
import antfu from '@antfu/eslint-config';
import reactHooks from 'eslint-plugin-react-hooks';
import {
facadePreset,
headerPreset,
indexEntryPreset,
noBarrelImportPreset,
penetratingPreset,
specPreset,
tailwindcssPreset,
typescriptPreset,
univerSourcePreset,
} from './presets';
import { baseRules } from './rules';
export interface IUniverEslintConfigOptions {
ignores?: string[];
header?: boolean;
noFacadeImportsOutsideFacade?: {
ignore?: string[];
};
rules?: Partial<Rules>;
}
export const createUniverEslintConfig = (options: IUniverEslintConfigOptions = {}) => {
const configs: Linter.Config[] = [
{
files: ['**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}'],
plugins: {
'react-hooks': reactHooks as unknown as ESLint.Plugin,
},
rules: {
...baseRules,
...options.rules,
},
},
penetratingPreset(),
typescriptPreset(),
indexEntryPreset(),
univerSourcePreset({
noFacadeImportsOutsideFacade: options.noFacadeImportsOutsideFacade,
}),
facadePreset(),
noBarrelImportPreset(),
tailwindcssPreset(),
specPreset(),
];
if (options.header ?? true) {
configs.push(headerPreset());
}
return antfu(
{
ignores: options.ignores,
stylistic: {
indent: 4,
semi: true,
},
e18e: false,
regexp: false,
react: true,
pnpm: false,
yaml: {
overrides: {
'yaml/indent': ['error', 4, { indicatorValueIndent: 2 }],
},
},
markdown: false,
typescript: true,
formatters: {
css: true,
html: true,
},
},
...configs
);
};