Check standards (mirror CI locally)
Runs, over the changed files only, the same gates CI applies on Wazuh Dashboard PRs, so failures are caught before they burn CI minutes. Fix issues, then re-run until clean.
The approach is generic; blocks marked repo-specific cover this repo's exact commands (test runner, lint, typecheck).
Workflow
- [ ] 1. Compute changed files vs the base branch
- [ ] 2. Prettier --check (autofix with --write)
- [ ] 3. ESLint (autofix with --fix)
- [ ] 4. Typecheck
- [ ] 5. Unit tests for the changed code
- [ ] 6. Report pass/fail summary
1. Compute changed files
Match how CI computes them (diff against the base branch, excluding deletions):
BASE=<version-branch> # e.g. 5.0.0 — the PR base
git fetch origin "$BASE"
CHANGED=$(git diff --name-status --diff-filter=d "origin/$BASE"...HEAD | awk '{print $NF}')
CODE=$(echo "$CHANGED" | grep -E '\.[jt]sx?$' || true) # js/jsx/ts/tsx only
echo "$CHANGED"
2. Prettier (format)
Check the changed files the same way pre-commit (.lintstagedrc) would:
npx prettier $CHANGED --check --ignore-unknown
# autofix:
npx prettier $CHANGED --write --ignore-unknown
repo-specific (wazuh-dashboard-notifications): this repo has its own local
.prettierrc(es5trailing commas, single quotes, 80-col) — Prettier resolves it from the repo root, not the parent checkout..prettierignoreskips*.mdand*.lock, so don't expect those to be reformatted. A.lintstagedrcrunsprettier --writeon staged files, but there is no husky hook wired in this repo — run Prettier yourself.
3. ESLint
repo-specific (wazuh-dashboard-notifications): ESLint config is
.eslintrc.js(extends@elastic/eslint-config-kibana+plugin:@elastic/eui/recommended; a legacy YAML.eslintrcis also present), and the lint script runs through the parent checkout.yarn lintruns both ESLint and Stylelint (node ../../scripts/eslint . && node ../../scripts/stylelint). Run it from this plugin's dir insidewazuh-dashboard/plugins/<this-plugin>. It enforces the short SPDX license header on.js/.ts/.tsxfiles, so new files need theCopyright OpenSearch Contributors/SPDX-License-Identifier: Apache-2.0block.yarn lint # ESLint + Stylelint over the whole plugin node ../../scripts/eslint . --fix # autofix ESLintIf you need to scope ESLint to changed files,
node ../../scripts/eslint $CODEworks too (the@elastic/eslint-import-resolver-kibanaresolver needs the parent checkout'snode_modules).
4. Typecheck
repo-specific (wazuh-dashboard-notifications): there is no
typecheckscript.tsconfig.jsonextends../../tsconfig.json, so run it from inside the parent checkout:../../node_modules/.bin/tsc --noEmit -p tsconfig.json
5. Unit tests (changed code)
repo-specific (wazuh-dashboard-notifications): the test script is
yarn test:jest(it runsTZ=UTC ../../node_modules/.bin/jest --config ./test/jest.config.jsfrom inside thewazuh-dashboardcheckout atplugins/<this-plugin>). Bootstrap once (yarn osd bootstrapfrom thewazuh-dashboardroot), then:yarn test:jestScope for speed with a path/pattern (
yarn test:jest <path>). Refresh snapshots only when the change intends to (yarn test:jest -u).
Remember: unit tests are colocated (*.test.ts / *.test.tsx, typically in
__tests__/ folders next to the source, snapshots under __snapshots__/). New
source files should ship with their colocated test.
6. Report
Summarize each gate as pass/fail; if anything failed, list the offending files and either fix them or explain what needs manual attention:
Prettier: PASS
ESLint: FAIL (2 files) → public/components/Foo/Foo.tsx, server/routes/bar.ts
Typecheck: PASS
Jest: PASS
Only report "ready for review" once every applicable gate passes.