Skip to content

no-deprecated-functions rule probably should try to find jest from its own directory upwards, not from cwd #886

@billbalm

Description

@billbalm

If we have multiple projects in a parent directory like this:

workspace/
├── project1/
│   └── node_modules/
│       ├── eslint/
│       ├── eslint-plugin-jest/
│       └── jest/
└── project2/
    └── node_modules/
        ├── eslint/
        ├── eslint-plugin-jest/
        └── jest/

Then if we run eslint in project1 from workspace folder, require.resolve throws
because from working directory it can't resolve jest/package.json. Now if we remove this line it
works obviously: https://github.com/jest-community/eslint-plugin-jest/blob/main/src/rules/no-deprecated-functions.ts#L45

Easy to reproduce with @dbaeumer's plugin for VSCode.
If we open workspace folder above in VSCode, no-deprecated-functions rule throws.

Not sure if there's a strong reason to resolve jest from process.cwd(). If not, can we remove that line?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions