Skip to content

Commit

Permalink
Add workaround for missing depcheck parser config
Browse files Browse the repository at this point in the history
The .mjs and .cjs parser configuration has been implemented in
depcheck/depcheck#773, but it has not yet been published
and may not be published for some time.

In the meantime, configure this directly in the Preflight depcheck command

TODO: Remove this once depcheck PR is published:

depcheck/depcheck#773 (comment)
  • Loading branch information
karlhorky committed Aug 10, 2023
1 parent 6344184 commit 3824c8b
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/checks/noDependencyProblems/noUnusedDependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,23 @@ export default async function noUnusedAndMissingDependencies() {

try {
await execaCommand(
`${preflightBinPath}/depcheck --ignores="${ignoredPackagePatterns}"`,
`${preflightBinPath}/depcheck --ignores="${ignoredPackagePatterns}" --parsers="${
// TODO: Remove this once depcheck PR is published:
// https://github.com/depcheck/depcheck/pull/773#issuecomment-1649749599
[
'**/*.js:jsx',
'**/*.mjs:jsx',
'**/*.cjs:jsx',
'**/*.jsx:jsx',
'**/*.graphql:graphql',
'**/*.cts:typescript',
'**/*.mts:typescript',
'**/*.ts:typescript',
'**/*.tsx:typescript',
'**/*.sass:sass',
'**/*.scss:sass',
].join(',')
}"`,
);
} catch (error) {
const { stdout } = error as { stdout: string };
Expand Down

0 comments on commit 3824c8b

Please sign in to comment.