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;