Skip to content

Commit c3326d2

Browse files
lubienfisker
authored andcommitted
Rename variables on expiring-todo-comments (#399)
See #397 (comment)
1 parent dd79136 commit c3326d2

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

rules/expiring-todo-comments.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ const MESSAGE_ID_ENGINE_MATCHES = 'engineMatches';
1717
const MESSAGE_ID_REMOVE_WHITESPACES = 'removeWhitespaces';
1818
const MESSAGE_ID_MISSING_AT_SYMBOL = 'missingAtSymbol';
1919

20-
const hasPackage = readPkgUp.sync();
21-
const pkg = hasPackage ? hasPackage.package : {};
20+
const packageResult = readPkgUp.sync();
21+
const hasPackage = Boolean(packageResult);
22+
const packageJson = hasPackage ? packageResult.package : {};
2223

2324
const pkgDependencies = {
24-
...pkg.dependencies,
25-
...pkg.devDependencies
25+
...packageJson.dependencies,
26+
...packageJson.devDependencies
2627
};
2728

2829
const DEPENDENCY_INCLUSION_RE = /^[+|-]\s*@?[\S+]\/?\S+/;
@@ -282,7 +283,7 @@ const create = context => {
282283
uses++;
283284
const [{condition, version}] = packageVersions;
284285

285-
const pkgVersion = tryToCoerceVersion(pkg.version);
286+
const pkgVersion = tryToCoerceVersion(packageJson.version);
286287
const desidedPkgVersion = tryToCoerceVersion(version);
287288

288289
const compare = semverComparisonForOperator(condition);
@@ -351,7 +352,7 @@ const create = context => {
351352
}
352353
}
353354

354-
const pkgEngines = pkg.engines || {};
355+
const pkgEngines = packageJson.engines || {};
355356

356357
for (const engine of engines) {
357358
uses++;

0 commit comments

Comments
 (0)