Skip to content

Commit

Permalink
Try removing ignores of missing dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
karlhorky committed Nov 12, 2023
1 parent aa0d42c commit 9407509
Showing 1 changed file with 2 additions and 39 deletions.
41 changes: 2 additions & 39 deletions src/checks/noDependencyProblems/noUnusedDependencies.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { sep } from 'node:path';
import { execaCommand } from 'execa';
import commandExample from '../../util/commandExample';
import preflightBinPath from '../../util/preflightBinPath';
Expand Down Expand Up @@ -95,43 +94,8 @@ export default async function noUnusedAndMissingDependencies() {
}

if (missingDependenciesStdout) {
/**
* Temporary workaround to filter out eslint-config-upleveled peer dependencies
* not listed in `package.json`, which are flagged as missing dependencies by depcheck
*
* TODO: Remove this variable once this depcheck issue is fixed:
* https://github.com/depcheck/depcheck/issues/789
*/
const missingDependenciesStdoutFiltered = missingDependenciesStdout
.split('\n')
.filter((missingDependency) => {
return !(
missingDependency.includes(`.${sep}.eslintrc.cjs`) &&
[
'@next/eslint-plugin-next',
'@typescript-eslint/eslint-plugin',
'@typescript-eslint/parser',
'eslint-plugin-upleveled',
'eslint-config-react-app',
'eslint-import-resolver-typescript',
'eslint-plugin-import',
'eslint-plugin-jsx-a11y',
'eslint-plugin-jsx-expressions',
'eslint-plugin-react-hooks',
'eslint-plugin-react',
'eslint-plugin-security',
'eslint-plugin-sonarjs',
'eslint-plugin-unicorn',
].some((excludedDependency) =>
missingDependency.includes(excludedDependency),
)
);
})
.join('\n');

if (missingDependenciesStdoutFiltered) {
messages.push(`Missing dependencies found:
${missingDependenciesStdoutFiltered
messages.push(`Missing dependencies found:
${missingDependenciesStdout
.split('\n')
.filter((str: string) => str.includes('* '))
.join('\n')}
Expand All @@ -140,7 +104,6 @@ export default async function noUnusedAndMissingDependencies() {
${commandExample('pnpm add <dependency name here>')}
`);
}
}

if (messages.length > 0) throw new Error(messages.join('\n\n'));
Expand Down

0 comments on commit 9407509

Please sign in to comment.