Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/presubmit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,18 @@ jobs:
env:
BUILD_TYPE: presubmit
TEST_TYPE: units
lint:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
fetch-depth: 300
persist-credentials: false
- name: Use Node.js 18
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: 18
- run: npm install
- run: npm run lint
name: Run monorepo linter
15 changes: 2 additions & 13 deletions bin/linter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ async function run() {
} catch (err) {
console.error('\nLinter failed:', err.message);
// Setting exit code 1 to indicate failure. In the CI pipeline,
// a non-zero exit code will cause the check to fail and block the PR.
// Note: TypeScript (tsc) compile failures and ESLint errors (severity 2)
// are blocking.
// continue-on-error is used to ensure this does not block PRs.
process.exitCode = 1;
}
}
Expand Down Expand Up @@ -114,27 +112,18 @@ async function checkEslint(filesToCheck) {
}

let hasBlockingErrors = false;
let hasFormattingErrors = false;

for (const fileResult of results) {
for (const message of fileResult.messages) {
// message.severity === 2 indicates an error-level rule configuration.
if (message.severity === 2) {
hasBlockingErrors = true;
if (message.ruleId === 'prettier/prettier') {
hasFormattingErrors = true;
}
}
}
}

if (hasBlockingErrors) {
console.error('\n[ERROR] Blocking ESLint violations were detected. ESLint errors are blocking and must be fixed.');
if (hasFormattingErrors) {
console.log(
`\nTo fix formatting issues, run:\n ./node_modules/.bin/eslint --fix ${filesToCheck.map(f => `"${f}"`).join(' ')}`,
);
}
console.error('\n[ERROR] ESLint violations were detected.');
return false;
}

Expand Down
Loading