Skip to content

Commit 7a6fe39

Browse files
committed
build: rename validate-pkg-json to lint-pkgs-metadata-files and move to lint/pkgs
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: passed - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 8c1fd92 commit 7a6fe39

4 files changed

Lines changed: 25 additions & 22 deletions

File tree

.github/workflows/lint_changed_files.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,11 @@ jobs:
171171
run: |
172172
. "$GITHUB_WORKSPACE/.github/workflows/scripts/common/lint_package_json_files" "${{ steps.changed-files.outputs.files }}"
173173
174-
# Validate package.json metadata:
175-
- name: 'Validate package.json metadata'
174+
# Lint package.json metadata:
175+
- name: 'Lint package.json metadata'
176176
if: success() || failure()
177177
run: |
178-
make validate-pkg-json FILES="${{ steps.changed-files.outputs.files }}"
178+
make lint-pkgs-metadata-files FILES="${{ steps.changed-files.outputs.files }}"
179179
180180
# Lint REPL help files...
181181
- name: 'Lint REPL help files'

tools/git/hooks/pre-commit

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,10 @@ run_lint() {
254254
else
255255
task_status 'skipped'
256256
fi
257-
add_task 'validate_package_json'
257+
add_task 'lint_pkgs_metadata'
258258
if [[ -z "${skip_package_json}" ]]; then
259259
files=$(echo "${changed_files}" | tr '\n' ' ')
260-
make FILES="${files}" validate-pkg-json > /dev/null >&2
260+
make FILES="${files}" lint-pkgs-metadata-files > /dev/null >&2
261261
if [[ "$?" -ne 0 ]]; then
262262
task_status 'failed'
263263
echo '' >&2

tools/make/lib/lint/package_json.mk

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ PACKAGE_JSON_LINTER ?= $(TOOLS_PKGS_DIR)/lint/pkg-json/bin/cli
2424
# Define the command-line options to be used when invoking the executable:
2525
PACKAGE_JSON_LINTER_FLAGS ?=
2626

27-
# Define the path for script validating `package.json` metadata:
28-
VALIDATE_PKG_JSON ?= "${TOOLS_PKGS_DIR}/package-json/scripts/validate_package_json_files"
29-
3027

3128
# RULES #
3229

@@ -41,17 +38,3 @@ lint-pkg-json: $(NODE_MODULES)
4138
$(QUIET) NODE_PATH="$(NODE_PATH)" $(NODE) "$(PACKAGE_JSON_LINTER)" $(PACKAGE_JSON_LINTER_FLAGS) "$(ROOT_DIR)"
4239

4340
.PHONY: lint-pkg-json
44-
45-
#/
46-
# Validates `package.json` metadata associated with a list of files.
47-
#
48-
# @param {string} FILES - list of file paths
49-
#
50-
# @example
51-
# make validate-pkg-json FILES='/foo/lib/index.js /bar/package.json'
52-
#/
53-
validate-pkg-json: $(NODE_MODULES)
54-
$(QUIET) echo 'Validating package.json metadata...'
55-
$(QUIET) $(VALIDATE_PKG_JSON) $(FILES)
56-
57-
.PHONY: validate-pkg-json

tools/make/lib/lint/pkgs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
# limitations under the License.
1717
#/
1818

19+
# VARIABLES #
20+
21+
# Define the path for script validating `package.json` metadata:
22+
VALIDATE_PKG_JSON ?= "${TOOLS_PKGS_DIR}/package-json/scripts/validate_package_json_files"
23+
24+
1925
# RULES #
2026

2127
# TODO: support linting filenames, package.json, REPL help, JavaScript CLI files (see pre-commit hook), license headers
@@ -44,3 +50,17 @@ lint-pkgs: lint-editorconfig
4450
$(QUIET) $(MAKE) -f $(this_file) lint-typescript TYPESCRIPT_DECLARATIONS_FILTER=$(PACKAGES_FILTER) TYPESCRIPT_DECLARATIONS_TESTS_FILTER=$(PACKAGES_FILTER)
4551

4652
.PHONY: lint-pkgs
53+
54+
#/
55+
# Lints `package.json` metadata associated with a list of files.
56+
#
57+
# @param {string} FILES - list of file paths
58+
#
59+
# @example
60+
# make lint-pkgs-metadata-files FILES='/foo/lib/index.js /bar/package.json'
61+
#/
62+
lint-pkgs-metadata-files: $(NODE_MODULES)
63+
$(QUIET) echo 'Linting package.json metadata...'
64+
$(QUIET) $(VALIDATE_PKG_JSON) $(FILES)
65+
66+
.PHONY: lint-pkgs-metadata-files

0 commit comments

Comments
 (0)