snapshot of https://github.com/dream-num/univer.git (dev, 2026-09-16; blobs > 131072B omitted)
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
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
This commit is contained in:
80
common/shared/eslint/config.ts
Normal file
80
common/shared/eslint/config.ts
Normal file
@@ -0,0 +1,80 @@
|
||||
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
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user