chore(configs): migrate oxlint→eslint presets, refactor tsconfig
- Replace @robonen/oxlint with @robonen/eslint (composable ESLint flat-config presets: base, typescript, vue, vitest, imports, node, stylistic). - Plugins bundled as deps: typescript-eslint, eslint-plugin-vue, @vitest/eslint-plugin, eslint-plugin-import-x, eslint-plugin-n, eslint-plugin-unicorn, @stylistic/eslint-plugin. - @robonen/tsconfig: add base/dom/node/vue configs for composite project refs.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import type { FlatConfigArray, FlatConfigInput } from './types';
|
||||
|
||||
/**
|
||||
* Compose multiple ESLint flat configurations into a single flat config array.
|
||||
*
|
||||
* ESLint flat config is an ordered array where later entries override earlier
|
||||
* ones, so composition is a flatten: each preset (an array) and each inline
|
||||
* override (a single object) are concatenated in order. `undefined`/`null`
|
||||
* inputs are skipped, allowing conditional spreads.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* import { compose, base, typescript, vue } from '@robonen/eslint';
|
||||
*
|
||||
* export default compose(base, typescript, vue, {
|
||||
* rules: { 'no-console': 'off' },
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
export function compose(...configs: Array<FlatConfigInput | false | null | undefined>): FlatConfigArray {
|
||||
const result: FlatConfigArray = [];
|
||||
|
||||
for (const config of configs) {
|
||||
if (!config)
|
||||
continue;
|
||||
|
||||
if (Array.isArray(config))
|
||||
result.push(...config);
|
||||
else
|
||||
result.push(config);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user