Skip to content

detector.findScript matches on substrings of script values (false positives) #6

Description

@rafaelvieiras

Problem

findScript('lint') / findScript('coverage') match the keyword against both the script key and its value. A script like "ci": "... eslint ..." can be wrongly elected as lintScript and later invoked as npm run ci -- --format json .... Same fragility for testCoverageScript.

Location

src/installer/detector.mjs:107-114

Suggested fix

Prefer exact/known key matches (lint, lint:js, test:coverage, test:cov, coverage) over substring-in-value matching; only fall back to value matching for unambiguous commands.

Acceptance

  • A ci/build script that merely mentions eslint/coverage in its value is not selected.
  • Tests covering the disambiguation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions