Skip to content

Commit 6432727

Browse files
committed
fix(lint): report missing lint configuration
1 parent 5c7b4e9 commit 6432727

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

packages/rstack/src/rslintConfig.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,22 @@ import { existsSync } from 'node:fs';
22
import { join } from 'node:path';
33
import { loadRstackConfig, type LoadedRstackConfig } from './config.ts';
44
import type { RslintConfig } from '@rslint/core';
5+
import { color, logger } from 'rslog';
56

67
// Expose the loaded config so `rs check` can pass it to fmt instead of loading
78
// and executing the Rstack config a second time.
89
export const loadedConfig: LoadedRstackConfig = await loadRstackConfig();
910
const { configs } = loadedConfig;
10-
const lintDefinition = configs.lint ?? [];
11+
const lintDefinition = configs.lint;
1112

1213
let lintConfig: RslintConfig;
1314

14-
// TODO: support function in Rslint core
15-
if (typeof lintDefinition === 'function') {
15+
if (lintDefinition === undefined) {
16+
logger.error(
17+
`No lint configuration found. Add ${color.cyan('define.lint(...)')} to your Rstack config file.`,
18+
);
19+
process.exit(1);
20+
} else if (typeof lintDefinition === 'function') {
1621
lintConfig = await lintDefinition();
1722
} else {
1823
lintConfig = lintDefinition;

0 commit comments

Comments
 (0)