kentcdodds / kentcdodds/kcd-scripts

istanbul ignore else

Open
#218 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
889
Forks
205
PR merge metrics
No merged PRs in 30d

Description

- `kcd-scripts` version: 11.2.0
- `node` version: any
- `npm` (or `yarn`) version: any

Relevant code or config

https://github.com/testing-library/user-event/pull/706/files#diff-79de2fcdb58def5d2000c20beddc4bb5a30488589e20c207181967dd0e75aa72R28

What you did:

Run CI with `"kcd-scripts": "^11.1.0"`.

What happened:

After release of `v11.2.0` CI fails due to uncovered lines.
Turns out istanbul expects the `/* istanbul ignore else */` right in between `else if` now.

The pre-commit hook reverts the change and therefore commits fixing this have to be committed with `--no-verify`.

Reproduction repository:

https://github.com/testing-library/user-event/pull/706

Problem description:

`kcd-scripts lint` does not flag `/* istanbul ignore else */ else if`.
`kcd-scripts/husky` adds a pre-commit hook that changes the (now) correct `else /* istanbul ignore else */ if` back to `/* istanbul ignore else */ else if`.

Suggested solution:

Report a lint error for `/* istanbul ignore else */ else if`.
Lint-fix to `else /* istanbul ignore else */ if`.

Contributor guide

Open the contributing guide

Research direction

Start with the kcd-scripts lint entry point and the kcd-scripts/husky hook mentioned in the issue. Reproduce the behavior using the linked kcd-scripts 11.2.0 setup, then verify that the lint rule reports the misplaced Istanbul directive and that lint-fix produces the expected placement.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.