Skip to content

Commit

Permalink
expiring-todo-comments: Do not normalize package.json (#1871) (#2020)
Browse files Browse the repository at this point in the history
  • Loading branch information
schmkr authored Feb 1, 2023
1 parent ba1a00e commit fcd8934
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rules/expiring-todo-comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ const messages = {
'Unexpected \'{{matchedTerm}}\' comment without any conditions: \'{{comment}}\'.',
};

const packageResult = readPkgUp.sync();
// We don't need to normalize the package.json data, because we are only using 2 properties and those 2 properties
// aren't validated by the normalization. But when this plugin is used in a monorepo, the name field in the
// package.json is invalid and would make this plugin throw an error. See also #1871
const packageResult = readPkgUp.sync({normalize: false});
const hasPackage = Boolean(packageResult);
const packageJson = hasPackage ? packageResult.packageJson : {};

Expand Down

0 comments on commit fcd8934

Please sign in to comment.