npm-package-json-lint 5.2.3 → 5.4.1

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/index.d.ts CHANGED
@@ -20,9 +20,24 @@ interface LinterResult {
20
20
  warningCount: number;
21
21
  }
22
22
 
23
+ type Severity = 'error' | 'warning' | 'off';
24
+
25
+ type RuleConfig = Severity | [Severity, ...any[]];
26
+
27
+ type RuleSet = Record<string, RuleConfig>;
28
+
29
+ interface NpmPackageJsonLintConfig {
30
+ extends?: string | string[];
31
+ rules?: RuleSet;
32
+ overrides: {
33
+ patterns: string[];
34
+ rules: RuleSet;
35
+ }[];
36
+ }
37
+
23
38
  type NpmPackageJsonLintOptions = {
24
39
  cwd?: string;
25
- config?: object;
40
+ config?: NpmPackageJsonLintConfig;
26
41
  configFile?: string;
27
42
  configBaseDirectory?: string;
28
43
  quiet?: boolean;
@@ -51,5 +66,7 @@ export {
51
66
  export type {
52
67
  FileLintResult,
53
68
  LinterResult,
54
- LintIssue
69
+ LintIssue,
70
+ Severity,
71
+ NpmPackageJsonLintConfig
55
72
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-package-json-lint",
3
- "version": "5.2.3",
3
+ "version": "5.4.1",
4
4
  "description": "Configurable linter for package.json files.",
5
5
  "keywords": [
6
6
  "lint",
@@ -40,12 +40,12 @@
40
40
  "ajv": "^6.12.6",
41
41
  "ajv-errors": "^1.0.1",
42
42
  "chalk": "^4.1.2",
43
- "cosmiconfig": "^6.0.0",
43
+ "cosmiconfig": "^7.0.1",
44
44
  "debug": "^4.3.2",
45
45
  "globby": "^11.0.4",
46
46
  "ignore": "^5.1.8",
47
47
  "is-plain-obj": "^3.0.0",
48
- "jsonc-parser": "^2.3.1",
48
+ "jsonc-parser": "^3.0.0",
49
49
  "log-symbols": "^4.1.0",
50
50
  "meow": "^6.1.1",
51
51
  "plur": "^4.0.0",
@@ -58,14 +58,14 @@
58
58
  "eslint-config-tc": "^15.0.0",
59
59
  "eslint-formatter-pretty": "^4.1.0",
60
60
  "eslint-plugin-eslint-comments": "^3.2.0",
61
- "eslint-plugin-import": "^2.24.0",
62
- "eslint-plugin-jest": "^24.4.0",
63
- "eslint-plugin-prettier": "^3.4.0",
61
+ "eslint-plugin-import": "^2.25.2",
62
+ "eslint-plugin-jest": "^24.6.0",
63
+ "eslint-plugin-prettier": "^3.4.1",
64
64
  "figures": "^3.2.0",
65
- "jest": "^27.0.6",
65
+ "jest": "^27.3.1",
66
66
  "npm-package-json-lint-config-default": "^3.0.0",
67
67
  "npm-package-json-lint-config-tc": "^4.1.0",
68
- "prettier": "^2.3.2"
68
+ "prettier": "^2.4.1"
69
69
  },
70
70
  "engines": {
71
71
  "node": ">=10.0.0",
@@ -0,0 +1,20 @@
1
+ const {exists} = require('../validators/property');
2
+ const LintIssue = require('../LintIssue');
3
+
4
+ const lintId = 'prefer-no-contributors';
5
+ const nodeName = 'contributors';
6
+ const message = 'contributors should not be defined';
7
+ const ruleType = 'standard';
8
+
9
+ const lint = (packageJsonData, severity) => {
10
+ if (exists(packageJsonData, nodeName)) {
11
+ return new LintIssue(lintId, severity, nodeName, message);
12
+ }
13
+
14
+ return true;
15
+ };
16
+
17
+ module.exports = {
18
+ lint,
19
+ ruleType,
20
+ };
@@ -242,7 +242,7 @@ const isGithubRepositoryShortcut = (version) => {
242
242
  * @return {boolean} True if the version is url to archive
243
243
  */
244
244
  const isArchiveUrl = (version) => {
245
- return version.endsWith('.tar.gz') || version.endsWith('.zip');
245
+ return version.endsWith('.tgz') || version.endsWith('.tar.gz') || version.endsWith('.zip');
246
246
  };
247
247
 
248
248
  /**