Skip to content

Commit

Permalink
Add npm-package-json-lint (#2150)
Browse files Browse the repository at this point in the history
* Add npm-package-json-lint

* Add cspell words

* Add default template

* Test files

* Update changelog

* Generated files

* Add cli_executable

* Add cli_help_arg_name and test_folder descriptor fields

* Change cli_lint_mode and add cli_lint_extra_args_after

* Update schema

* Fix package.json
  • Loading branch information
bdovaz committed Dec 22, 2022
1 parent 2e0e163 commit abfc7df
Show file tree
Hide file tree
Showing 40 changed files with 121 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .automation/generated/linter-links-previews.json
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,11 @@
"image": "https://repository-images.githubusercontent.com/240214900/1dcdef80-773c-11ea-8c94-305acc58f5c6",
"title": "nvuillam/npm-groovy-lint"
},
"npm-package-json-lint": {
"description": "A configurable linter for package.json files",
"image": null,
"title": "npm-package-json-lint | npm-package-json-lint"
},
"perlcritic": {
"description": "Critique Perl source code for best-practices.",
"image": null,
Expand Down
3 changes: 3 additions & 0 deletions .automation/test/npm_package_json_lint/bad/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name": "test-package"
}
4 changes: 4 additions & 0 deletions .automation/test/npm_package_json_lint/good/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "test-package",
"version": "1.2.3"
}
4 changes: 3 additions & 1 deletion .github/linters/.cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,8 @@
"nowrap",
"noxincludenode",
"npmignore",
"npmpackagejsonlintignore",
"npmpackagejsonlintrc",
"npmrc",
"nsclean",
"nunjucks",
Expand Down Expand Up @@ -1343,4 +1345,4 @@
"\u0636clojure",
"\u077bcbad"
]
}
}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l
- HTML email not rendering correctly ([#2120](https://github.com/oxsecurity/megalinter/issues/2120)). Set `REPORTERS_MARKDOWN_TYPE` to `simple` to avoid external images in PR/MR markdown comments.
- Fix branding to use the correct 'OX Security' name

- Linters
- Add [npm-package-json-lint](https://github.com/tclindner/npm-package-json-lint) linter

- Linter versions upgrades
- [cspell](https://github.com/streetsidesoftware/cspell/tree/master/packages/cspell) from 6.14.3 to **6.15.0** on 2022-11-26
- [swiftlint](https://github.com/realm/SwiftLint) from 0.50.0 to **0.50.1** on 2022-11-26
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ RUN npm --no-cache install --ignore-scripts \
@prantlf/jsonlint \
eslint-plugin-jsonc \
v8r \
npm-package-json-lint \
npm-package-json-lint-config-default \
eslint-plugin-react \
eslint-plugin-jsx-a11y \
markdownlint-cli \
Expand Down
3 changes: 3 additions & 0 deletions TEMPLATES/.npmpackagejsonlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "npm-package-json-lint-config-default"
}
2 changes: 2 additions & 0 deletions flavors/ci_light/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ RUN npm --no-cache install --ignore-scripts \
@microsoft/eslint-formatter-sarif \
v8r \
prettier \
npm-package-json-lint \
npm-package-json-lint-config-default \
secretlint \
@secretlint/secretlint-rule-preset-recommend \
@secretlint/secretlint-formatter-sarif && \
Expand Down
1 change: 1 addition & 0 deletions flavors/ci_light/flavor.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"JSON_ESLINT_PLUGIN_JSONC",
"JSON_V8R",
"JSON_PRETTIER",
"JSON_NPM_PACKAGE_JSON_LINT",
"MAKEFILE_CHECKMAKE",
"REPOSITORY_GIT_DIFF",
"REPOSITORY_GITLEAKS",
Expand Down
2 changes: 2 additions & 0 deletions flavors/cupcake/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ RUN npm --no-cache install --ignore-scripts \
@prantlf/jsonlint \
eslint-plugin-jsonc \
v8r \
npm-package-json-lint \
npm-package-json-lint-config-default \
eslint-plugin-react \
eslint-plugin-jsx-a11y \
markdownlint-cli \
Expand Down
1 change: 1 addition & 0 deletions flavors/cupcake/flavor.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"JSON_ESLINT_PLUGIN_JSONC",
"JSON_V8R",
"JSON_PRETTIER",
"JSON_NPM_PACKAGE_JSON_LINT",
"JSX_ESLINT",
"KOTLIN_KTLINT",
"KUBERNETES_KUBEVAL",
Expand Down
2 changes: 2 additions & 0 deletions flavors/documentation/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ RUN npm --no-cache install --ignore-scripts \
@microsoft/eslint-formatter-sarif \
v8r \
prettier \
npm-package-json-lint \
npm-package-json-lint-config-default \
markdownlint-cli \
markdown-link-check \
markdown-table-formatter \
Expand Down
1 change: 1 addition & 0 deletions flavors/documentation/flavor.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"JSON_ESLINT_PLUGIN_JSONC",
"JSON_V8R",
"JSON_PRETTIER",
"JSON_NPM_PACKAGE_JSON_LINT",
"KOTLIN_KTLINT",
"KUBERNETES_KUBEVAL",
"KUBERNETES_KUBECONFORM",
Expand Down
2 changes: 2 additions & 0 deletions flavors/dotnet/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ RUN npm --no-cache install --ignore-scripts \
@microsoft/eslint-formatter-sarif \
v8r \
prettier \
npm-package-json-lint \
npm-package-json-lint-config-default \
markdownlint-cli \
markdown-link-check \
markdown-table-formatter \
Expand Down
1 change: 1 addition & 0 deletions flavors/dotnet/flavor.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"JSON_ESLINT_PLUGIN_JSONC",
"JSON_V8R",
"JSON_PRETTIER",
"JSON_NPM_PACKAGE_JSON_LINT",
"KOTLIN_KTLINT",
"KUBERNETES_KUBEVAL",
"KUBERNETES_KUBECONFORM",
Expand Down
2 changes: 2 additions & 0 deletions flavors/go/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ RUN npm --no-cache install --ignore-scripts \
@microsoft/eslint-formatter-sarif \
v8r \
prettier \
npm-package-json-lint \
npm-package-json-lint-config-default \
markdownlint-cli \
markdown-link-check \
markdown-table-formatter \
Expand Down
1 change: 1 addition & 0 deletions flavors/go/flavor.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"JSON_ESLINT_PLUGIN_JSONC",
"JSON_V8R",
"JSON_PRETTIER",
"JSON_NPM_PACKAGE_JSON_LINT",
"KOTLIN_KTLINT",
"KUBERNETES_KUBEVAL",
"KUBERNETES_KUBECONFORM",
Expand Down
2 changes: 2 additions & 0 deletions flavors/java/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ RUN npm --no-cache install --ignore-scripts \
@microsoft/eslint-formatter-sarif \
v8r \
prettier \
npm-package-json-lint \
npm-package-json-lint-config-default \
markdownlint-cli \
markdown-link-check \
markdown-table-formatter \
Expand Down
1 change: 1 addition & 0 deletions flavors/java/flavor.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"JSON_ESLINT_PLUGIN_JSONC",
"JSON_V8R",
"JSON_PRETTIER",
"JSON_NPM_PACKAGE_JSON_LINT",
"KOTLIN_KTLINT",
"KUBERNETES_KUBEVAL",
"KUBERNETES_KUBECONFORM",
Expand Down
2 changes: 2 additions & 0 deletions flavors/javascript/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ RUN npm --no-cache install --ignore-scripts \
@prantlf/jsonlint \
eslint-plugin-jsonc \
v8r \
npm-package-json-lint \
npm-package-json-lint-config-default \
eslint-plugin-react \
eslint-plugin-jsx-a11y \
markdownlint-cli \
Expand Down
1 change: 1 addition & 0 deletions flavors/javascript/flavor.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"JSON_ESLINT_PLUGIN_JSONC",
"JSON_V8R",
"JSON_PRETTIER",
"JSON_NPM_PACKAGE_JSON_LINT",
"JSX_ESLINT",
"KOTLIN_KTLINT",
"KUBERNETES_KUBEVAL",
Expand Down
2 changes: 2 additions & 0 deletions flavors/php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ RUN npm --no-cache install --ignore-scripts \
@microsoft/eslint-formatter-sarif \
v8r \
prettier \
npm-package-json-lint \
npm-package-json-lint-config-default \
markdownlint-cli \
markdown-link-check \
markdown-table-formatter \
Expand Down
1 change: 1 addition & 0 deletions flavors/php/flavor.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"JSON_ESLINT_PLUGIN_JSONC",
"JSON_V8R",
"JSON_PRETTIER",
"JSON_NPM_PACKAGE_JSON_LINT",
"KOTLIN_KTLINT",
"KUBERNETES_KUBEVAL",
"KUBERNETES_KUBECONFORM",
Expand Down
2 changes: 2 additions & 0 deletions flavors/python/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ RUN npm --no-cache install --ignore-scripts \
@microsoft/eslint-formatter-sarif \
v8r \
prettier \
npm-package-json-lint \
npm-package-json-lint-config-default \
markdownlint-cli \
markdown-link-check \
markdown-table-formatter \
Expand Down
1 change: 1 addition & 0 deletions flavors/python/flavor.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"JSON_ESLINT_PLUGIN_JSONC",
"JSON_V8R",
"JSON_PRETTIER",
"JSON_NPM_PACKAGE_JSON_LINT",
"KOTLIN_KTLINT",
"KUBERNETES_KUBEVAL",
"KUBERNETES_KUBECONFORM",
Expand Down
2 changes: 2 additions & 0 deletions flavors/ruby/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ RUN npm --no-cache install --ignore-scripts \
@microsoft/eslint-formatter-sarif \
v8r \
prettier \
npm-package-json-lint \
npm-package-json-lint-config-default \
markdownlint-cli \
markdown-link-check \
markdown-table-formatter \
Expand Down
1 change: 1 addition & 0 deletions flavors/ruby/flavor.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"JSON_ESLINT_PLUGIN_JSONC",
"JSON_V8R",
"JSON_PRETTIER",
"JSON_NPM_PACKAGE_JSON_LINT",
"KOTLIN_KTLINT",
"KUBERNETES_KUBEVAL",
"KUBERNETES_KUBECONFORM",
Expand Down
2 changes: 2 additions & 0 deletions flavors/rust/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ RUN npm --no-cache install --ignore-scripts \
@microsoft/eslint-formatter-sarif \
v8r \
prettier \
npm-package-json-lint \
npm-package-json-lint-config-default \
markdownlint-cli \
markdown-link-check \
markdown-table-formatter \
Expand Down
1 change: 1 addition & 0 deletions flavors/rust/flavor.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"JSON_ESLINT_PLUGIN_JSONC",
"JSON_V8R",
"JSON_PRETTIER",
"JSON_NPM_PACKAGE_JSON_LINT",
"KOTLIN_KTLINT",
"KUBERNETES_KUBEVAL",
"KUBERNETES_KUBECONFORM",
Expand Down
2 changes: 2 additions & 0 deletions flavors/salesforce/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ RUN npm --no-cache install --ignore-scripts \
@microsoft/eslint-formatter-sarif \
v8r \
prettier \
npm-package-json-lint \
npm-package-json-lint-config-default \
markdownlint-cli \
markdown-link-check \
markdown-table-formatter \
Expand Down
1 change: 1 addition & 0 deletions flavors/salesforce/flavor.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"JSON_ESLINT_PLUGIN_JSONC",
"JSON_V8R",
"JSON_PRETTIER",
"JSON_NPM_PACKAGE_JSON_LINT",
"KOTLIN_KTLINT",
"KUBERNETES_KUBEVAL",
"KUBERNETES_KUBECONFORM",
Expand Down
2 changes: 2 additions & 0 deletions flavors/swift/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ RUN npm --no-cache install --ignore-scripts \
@microsoft/eslint-formatter-sarif \
v8r \
prettier \
npm-package-json-lint \
npm-package-json-lint-config-default \
markdownlint-cli \
markdown-link-check \
markdown-table-formatter \
Expand Down
1 change: 1 addition & 0 deletions flavors/swift/flavor.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"JSON_ESLINT_PLUGIN_JSONC",
"JSON_V8R",
"JSON_PRETTIER",
"JSON_NPM_PACKAGE_JSON_LINT",
"KOTLIN_KTLINT",
"KUBERNETES_KUBEVAL",
"KUBERNETES_KUBECONFORM",
Expand Down
2 changes: 2 additions & 0 deletions flavors/terraform/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ RUN npm --no-cache install --ignore-scripts \
@microsoft/eslint-formatter-sarif \
v8r \
prettier \
npm-package-json-lint \
npm-package-json-lint-config-default \
markdownlint-cli \
markdown-link-check \
markdown-table-formatter \
Expand Down
1 change: 1 addition & 0 deletions flavors/terraform/flavor.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"JSON_ESLINT_PLUGIN_JSONC",
"JSON_V8R",
"JSON_PRETTIER",
"JSON_NPM_PACKAGE_JSON_LINT",
"KOTLIN_KTLINT",
"KUBERNETES_KUBEVAL",
"KUBERNETES_KUBECONFORM",
Expand Down
Loading

0 comments on commit abfc7df

Please sign in to comment.