-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Note
The task was generated using the MCP server — prog-time/github-issues-server
Release: 1
Type: test
Priority: high
Blocks: —
Blocked by: —
Status: todo
Description
The script scripts/shell/linters/eslint.sh has no corresponding BATS test file. Every other linter script in scripts/shell/linters/ has a test counterpart in tests/linters/ (hadolint, htmlhint, markdownlint, shellcheck, stylelint, yamllint), but eslint.bats does not exist. This violates the project rule that every shell script must be covered by a BATS unit test (rules/process/ci-cd.md, section 9).
Motivation
Without tests, regressions in eslint.sh — config discovery logic, file collection, the ERROR_FOUND accumulator — will not be caught by CI. ESLint's config file detection is the most complex of all linter scripts: it checks seven possible filename variants (eslintrc.json, eslint.config.js, and five others). This logic is especially brittle without test coverage.
Target Structure
tests/
└── linters/
├── eslint.bats ← new file
├── hadolint.bats
├── htmlhint.bats
├── markdownlint.bats
├── shellcheck.bats
├── stylelint.bats
└── yamllint.bats
Checklist
- Create
tests/linters/eslint.batsmodelled ontests/linters/htmlhint.bats - Test: no ESLint config file found → exit 1, output contains
::error::No ESLint config file found - Test: config
.eslintrc.jsonfound, no JS/TS files → exit 0, output contains⚠️ No JS/TS files found. Skipping. - Test: config
eslint.config.jsfound (alternative format), all files pass → exit 0, output contains✅ All JS/TS files passed ESLint checks! - Test: config found, one file fails → exit 1, output contains
❌ ESLint found issues! - Test: config found, multiple files, one fails — all files are checked (accumulator pattern, does not stop on first error)
- Verify the test file uses helpers from
tests/helpers/common.bash(mock_tool/ conditional stub pattern matchinghtmlhint.bats) - Run
bats tests/linters/eslint.batslocally — all tests pass - Run
bats --recursive tests/— the full test suite passes
Affected Files
| File | Change |
|---|---|
tests/linters/eslint.bats |
create |