Thanks to visit codestin.com
Credit goes to github.com

Skip to content

#598 Nx plugin doesn't look in package.json#880

Merged
webpro merged 3 commits into
webpro-nl:mainfrom
ysknsid25:fix/598/add-config-package-json
Dec 16, 2024
Merged

#598 Nx plugin doesn't look in package.json#880
webpro merged 3 commits into
webpro-nl:mainfrom
ysknsid25:fix/598/add-config-package-json

Conversation

@ysknsid25
Copy link
Copy Markdown
Contributor

@ysknsid25 ysknsid25 commented Dec 16, 2024

Nice to meet you, @webpro !
This PR is in response to issue #598 .

Confirmation

Follow these steps to create a React project with nx installed.

I then installed nx and rimraf, added the following settings to package.json and npx knip and it reproduced as per the issue.

    "nx": {
        "targets": {
            "clean": {
                "executor": "nx:run-commands",
                "options": {
                    "command": "rimraf dist"
                }
            }
        }
    }

I then directly rewrote knip/packages/knip/src/plugins/nx/index.ts and rewrote npx knip again, and confirmed that the false positives were no longer being detected.

image

@webpro
Copy link
Copy Markdown
Member

webpro commented Dec 16, 2024

Thanks @ysknsid25! Nice to meet you too 😃

Any chance you could add that nx property with that config here: https://github.com/webpro-nl/knip/blob/main/packages/knip/fixtures/plugins/nx/package.json? Then, I'd expect a test to fail and then we'll have the coverage so our chances of regressing in the future is smaller.

@ysknsid25
Copy link
Copy Markdown
Contributor Author

@webpro
Roger, I'll try! 🫡

fix unit test

Signed-off-by: ysknsid25 <[email protected]>
fix unit test

Signed-off-by: ysknsid25 <[email protected]>
@ysknsid25
Copy link
Copy Markdown
Contributor Author

@webpro
The status of the reproduction procedure is reflected in the test code 🫡

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Dec 16, 2024

Open in Stackblitz

npm i https://pkg.pr.new/knip@880

commit: 1e7d669

@webpro
Copy link
Copy Markdown
Member

webpro commented Dec 16, 2024

Perfect. Thank you, Kanon!

@webpro webpro merged commit 9ce4a49 into webpro-nl:main Dec 16, 2024
@webpro
Copy link
Copy Markdown
Member

webpro commented Dec 16, 2024

🚀 This pull request is included in v5.41.0. See Release 5.41.0 for release notes.

Using Knip in a commercial project? Please consider becoming a sponsor.

@alecmev
Copy link
Copy Markdown

alecmev commented Dec 19, 2024

Thank you! 🙏

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants