From 7e3453da7a00b28ce5a9f177c5267a51d7ea95bc Mon Sep 17 00:00:00 2001 From: Sanniti Pimpley Date: Wed, 23 Oct 2024 14:15:59 -0400 Subject: [PATCH] chore(share-data): add format and lint targets for js (#16529) Adds `format-js` and `lint-js` targets to shared-data's makefile --- shared-data/Makefile | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/shared-data/Makefile b/shared-data/Makefile index a06c7979d9e..2e972110c19 100644 --- a/shared-data/Makefile +++ b/shared-data/Makefile @@ -9,20 +9,31 @@ tests ?= cov_opts ?= --coverage=true test_opts ?= +# warning suppression variables for tests and linting +quiet ?= false + +FORMAT_FILE_GLOB = "**/*.@(ts|tsx|js|json|md|yml)" + # Top level targets .PHONY: all all: clean dist .PHONY: setup -setup: setup-py setup-js +setup: setup-py .PHONY: dist -dist: dist-js dist-py +dist: dist-py .PHONY: clean clean: clean-py +.PHONY: format +format: format-js format-py + +.PHONY: lint +lint: lint-js lint-py + # JavaScript targets .PHONY: lib-js @@ -34,6 +45,22 @@ lib-js: build-ts: yarn tsc --build --emitDeclarationOnly +.PHONY: format-js +format-js: + yarn prettier --ignore-path ../.eslintignore --write $(FORMAT_FILE_GLOB) + +.PHONY: lint-js +lint-js: lint-js-eslint lint-js-prettier + +.PHONY: lint-js-eslint +lint-js-eslint: + yarn eslint --ignore-path ../.eslintignore --quiet=$(quiet) "**/*.@(js|ts|tsx)" + +.PHONY: lint-js-prettier +lint-js-prettier: + yarn prettier --ignore-path ../.eslintignore --check $(FORMAT_FILE_GLOB) + + # Python targets .PHONY: setup-py