From 6432727de1a0d8d01f19adc2dbbc59acc1bb6c71 Mon Sep 17 00:00:00 2001 From: neverland Date: Wed, 16 Sep 2026 12:13:53 +0800 Subject: [PATCH] fix(lint): report missing lint configuration --- packages/rstack/src/rslintConfig.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/rstack/src/rslintConfig.ts b/packages/rstack/src/rslintConfig.ts index 13dff073..b1f4faa6 100644 --- a/packages/rstack/src/rslintConfig.ts +++ b/packages/rstack/src/rslintConfig.ts @@ -2,17 +2,22 @@ import { existsSync } from 'node:fs'; import { join } from 'node:path'; import { loadRstackConfig, type LoadedRstackConfig } from './config.ts'; import type { RslintConfig } from '@rslint/core'; +import { color, logger } from 'rslog'; // Expose the loaded config so `rs check` can pass it to fmt instead of loading // and executing the Rstack config a second time. export const loadedConfig: LoadedRstackConfig = await loadRstackConfig(); const { configs } = loadedConfig; -const lintDefinition = configs.lint ?? []; +const lintDefinition = configs.lint; let lintConfig: RslintConfig; -// TODO: support function in Rslint core -if (typeof lintDefinition === 'function') { +if (lintDefinition === undefined) { + logger.error( + `No lint configuration found. Add ${color.cyan('define.lint(...)')} to your Rstack config file.`, + ); + process.exit(1); +} else if (typeof lintDefinition === 'function') { lintConfig = await lintDefinition(); } else { lintConfig = lintDefinition;