Skip to content
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

expiring-todo-comments: Do not normalize package.json (#1871) #2020

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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});
schmkr marked this conversation as resolved.
Show resolved Hide resolved
const hasPackage = Boolean(packageResult);
const packageJson = hasPackage ? packageResult.packageJson : {};

Expand Down