npm-pkg-lint 4.3.6 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5663,7 +5663,7 @@ function centerLineColumn(el) {
5663
5663
  return el.replace(/(\d+)\s+(\d+)/u, (_m, p1, p2) => dim2(`${p1}:${p2}`));
5664
5664
  }
5665
5665
  function stripAnsi(text) {
5666
- return text.replace(/\u001B\[[0-9;]*m/g, "");
5666
+ return text.replaceAll(/\u001B\[[\d;]*m/g, "");
5667
5667
  }
5668
5668
  function stylish(results) {
5669
5669
  let output = "\n";
@@ -5672,10 +5672,10 @@ function stylish(results) {
5672
5672
  let fixableErrorCount = 0;
5673
5673
  let fixableWarningCount = 0;
5674
5674
  let summaryColor = yellow2;
5675
- results.forEach((result) => {
5675
+ for (const result of results) {
5676
5676
  const messages = result.messages;
5677
5677
  if (messages.length === 0) {
5678
- return;
5678
+ continue;
5679
5679
  }
5680
5680
  errorCount += result.errorCount;
5681
5681
  warningCount += result.warningCount;
@@ -5710,7 +5710,7 @@ function stylish(results) {
5710
5710
  output += `${formattedTable}
5711
5711
 
5712
5712
  `;
5713
- });
5713
+ }
5714
5714
  const total = errorCount + warningCount;
5715
5715
  if (total > 0) {
5716
5716
  output += summaryColor(
@@ -11478,7 +11478,7 @@ function* outdatedEngines(pkg, pkgAst, ignoreNodeVersion) {
11478
11478
  if (!descriptor.eol) {
11479
11479
  break;
11480
11480
  }
11481
- const expanded = version2.replace(/[xX*]/g, "999");
11481
+ const expanded = version2.replaceAll(/[*Xx]/g, "999");
11482
11482
  if (!import_semver2.default.satisfies(expanded, range)) {
11483
11483
  continue;
11484
11484
  }
@@ -11711,13 +11711,14 @@ var ValidationError = class extends Error {
11711
11711
  validator;
11712
11712
  constructor(validator, message) {
11713
11713
  super(message);
11714
+ this.name = "ValidationError";
11714
11715
  this.validator = validator;
11715
11716
  }
11716
11717
  };
11717
11718
 
11718
11719
  // src/validators/non-empty.ts
11719
11720
  function isEmpty(value) {
11720
- return typeof value === "undefined" || value === null || value === "";
11721
+ return value === void 0 || value === null || value === "";
11721
11722
  }
11722
11723
  function nonempty(key, value) {
11723
11724
  if (isEmpty(value)) {
@@ -11745,7 +11746,7 @@ function nonempty(key, value) {
11745
11746
 
11746
11747
  // src/validators/present.ts
11747
11748
  function present(key, value) {
11748
- if (typeof value === "undefined" || value === null) {
11749
+ if (value === void 0 || value === null) {
11749
11750
  throw new ValidationError(present.name, `"${key}" must be set`);
11750
11751
  }
11751
11752
  }
@@ -11843,7 +11844,7 @@ function validRepoUrl(key, value) {
11843
11844
 
11844
11845
  // src/validators/valid-url.ts
11845
11846
  function validUrl(key, value) {
11846
- if (typeof value === "string" && /^https:\/\/.+$/.exec(value)) {
11847
+ if (typeof value === "string" && /^https:\/\/.+$/.test(value)) {
11847
11848
  return;
11848
11849
  } else if (value && typeof value === "object" && "url" in value) {
11849
11850
  validUrl(`${key}.url`, value.url);
@@ -11905,7 +11906,7 @@ function verifyDependencies(pkg, pkgAst, options) {
11905
11906
  if (options.allowedDependencies.has(dependency)) {
11906
11907
  continue;
11907
11908
  }
11908
- if (options.allowTypesDependencies && /^@types\//.exec(dependency)) {
11909
+ if (options.allowTypesDependencies && dependency.startsWith("@types/")) {
11909
11910
  continue;
11910
11911
  }
11911
11912
  if (isDisallowedDependency(pkg, dependency)) {
@@ -11986,7 +11987,7 @@ async function verifyShebang(pkg, tarball) {
11986
11987
  const contents = await getFileContent(tarball, binaries);
11987
11988
  for (const [filePath, content] of Object.entries(contents)) {
11988
11989
  const text = content.toString("utf-8");
11989
- if (/^#!.+?\r?\n/.exec(text)) {
11990
+ if (/^#!.+?\r?\n/.test(text)) {
11990
11991
  continue;
11991
11992
  }
11992
11993
  results.push({
@@ -12109,7 +12110,7 @@ async function run() {
12109
12110
  help: "ignore error for outdated node version (restricted to MAJOR version if given)"
12110
12111
  });
12111
12112
  const args = parser.parse_args();
12112
- const allowedDependencies2 = new Set(args.allow_dependency.map((it2) => it2.split(",")).flat());
12113
+ const allowedDependencies2 = new Set(args.allow_dependency.flatMap((it2) => it2.split(",")));
12113
12114
  if (args.cache) {
12114
12115
  await setCacheDirecory(args.cache);
12115
12116
  }
@@ -12157,10 +12158,7 @@ async function run() {
12157
12158
  }, 0);
12158
12159
  process.exitCode = totalErrors > 0 ? 1 : 0;
12159
12160
  }
12160
- run().catch((err) => {
12161
- console.error(err);
12162
- process.exitCode = 1;
12163
- });
12161
+ await run();
12164
12162
  /*! Bundled license information:
12165
12163
 
12166
12164
  tmp/lib/tmp.js: