Skip to content

[BUG] Double-hyphens can be interpreted as diff-commands leading danger to try to load comments as modified file paths #1387

@eppisapiafsl

Description

@eppisapiafsl

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Modify a file with a no-restricted-import rule disabled like this
/* eslint-disable-next-line no-restricted-imports
 -- we need to use useStore to access to Redux Store
 */
 import { useStore } from "react-redux";
  1. Log the modified files danger.git.modified_files
  2. The comment we need to use useStore to access to Redux Store is listed

Expected behavior
we need to use useStore to access to Redux Store shouldn't be in the list of modified files

Screenshots
Screenshot 2023-07-24 at 1 57 32 PM

Your Environment

software version
danger.js 11.2.1
node 18.15.0
npm 9.5.0
Operating System MacOs

Additional context

I'm using https://github.com/mysticatea/eslint-plugin-eslint-comments to force comments when disable a lint rule.

The error only happen when the file is modified, If I create a new file it works as expected

danger.git.created_files doesn't take the comment as a new file
danger.git.modified_files take the comment as a new file

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions