Skip to content

Commit cecdbdb

Browse files
committed
ci: let's debug
1 parent 5c9285d commit cecdbdb

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ jobs:
3636
run: yarn --immutable
3737

3838
- name: Build and Lint
39-
run: yarn run-p build docs lint typecov
39+
run: |
40+
set -ex
41+
yarn run-p build docs lint typecov
42+
yarn doom lint
4043
env:
4144
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4245
PARSER_NO_WATCH: true

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
"fixture": "yarn dev fixture-docs",
4646
"format": "prettier --write .",
4747
"lint": "run-p 'lint:*'",
48-
"lint:doom": "yarn doom lint",
4948
"lint:es": "eslint . --cache",
5049
"lint:tsc": "tsc -b",
5150
"prepare": "simple-git-hooks && patch-package && yarn-berry-deduplicate || exit 0",

src/cli/lint.ts

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ import type { Options } from '@cspell/eslint-plugin'
22
import cspellRecommended from '@cspell/eslint-plugin/recommended'
33
import js from '@eslint/js'
44
import react from '@eslint-react/eslint-plugin'
5+
import { logger } from '@rspress/shared/logger'
56
import { Command } from 'commander'
67
import { merge } from 'es-toolkit/compat'
78
import { ESLint } from 'eslint'
89
import * as mdx from 'eslint-plugin-mdx'
910
import tseslint from 'typescript-eslint'
1011

12+
import type { NormalizedTermItem } from '../terms.js'
1113
import type { GlobalCliOptions } from '../types.js'
1214

1315
import { parseTerms } from './helpers.js'
@@ -23,7 +25,13 @@ export const lintCommand = new Command('lint')
2325

2426
const docsDir = config.root!
2527

26-
const parsedTerms = await parseTerms()
28+
let parsedTerms: NormalizedTermItem[] = []
29+
30+
try {
31+
parsedTerms = await parseTerms()
32+
} catch (err) {
33+
logger.error('Failed to parse terms.yaml', err)
34+
}
2735

2836
const eslint = new ESLint({
2937
cwd: docsDir,
@@ -83,15 +91,30 @@ export const lintCommand = new Command('lint')
8391
]),
8492
})
8593

94+
logger.start('Linting...')
95+
8696
const results = await eslint.lintFiles('**/*.{js,jsx,ts,tsx,md,mdx}')
8797

8898
if (!results.length) {
8999
return
90100
}
91101

92-
process.exitCode = 1
102+
const errorCount = results.reduce(
103+
(count, result) => count + result.errorCount,
104+
0,
105+
)
106+
const warningCount = results.reduce(
107+
(count, result) => count + result.warningCount,
108+
0,
109+
)
110+
111+
logger.error(
112+
`Linting completed with ${errorCount} errors and ${warningCount} warnings`,
113+
)
93114

94115
const formatter = await eslint.loadFormatter('stylish')
95116

96117
process.stderr.write(await formatter.format(results))
118+
119+
process.exitCode = 1
97120
})

0 commit comments

Comments
 (0)