-
Notifications
You must be signed in to change notification settings - Fork 16
chore: setup knip to lint the workspace #555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Nice idea!! If you would create an example plugin under |
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 438aab6. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution
✅ Successfully ran 5 targetsSent with 💌 from NxCloud. |
|
I tried to directly execute the core knip logic export function runnerFunction(options: RunnerOptions) {
const {
cwd,
isIncludeEntryExports = false,
isIsolateWorkspaces = false,
isProduction = false,
isStrict = false,
isFix = false,
fixTypes = [],
tags = [[''], ['']] as Tags,
isNoGitIgnore = true,
} = options;
return async (): Promise<AuditOutputs> => {
const kinpReport = await main({
fixTypes,
cwd: cwd || process.cwd(),
tags,
gitignore: isNoGitIgnore,
tsConfigFile: '',
isShowProgress: false,
isStrict,
isFix,
isIncludeEntryExports,
isIsolateWorkspaces,
isProduction,
});
return knipToCpReport(kinpReport);
}
}I get the following error: |
|
As the example plugin is out of here now we could defined a scope for this one. I believe to be useful it should at least show no false positives. |
…o feat/setup-knip
# Conflicts: # package-lock.json
BioPhoton
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
This pr introduce a knip config for this repo. Setting up knip with an Nx Integrated workspace requires a bit more trickery than a regular npm workspace, so I created a library for it. The library is still in it's early form, but I will maintain and evolve it's api here if I make any breaking changes.
Source for the library can be found here.
To see the generated knip config, you can run
DEBUG=true npm run knip, it's traversing Nx's graph of library, executors and configuration to infer a knip config dynamically.Running knip on this repo yeild the following output :