From 1ca8c0ac26c8a255ef8ca03aa0b731c79793951c Mon Sep 17 00:00:00 2001 From: Sanniti Date: Fri, 18 Oct 2024 10:40:58 -0400 Subject: [PATCH 1/4] added eslintignore file and makefile targets for js format, lint --- shared-data/.eslintignore | 23 +++++++++++++++++++++++ shared-data/Makefile | 17 +++++++++++++++-- 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 shared-data/.eslintignore diff --git a/shared-data/.eslintignore b/shared-data/.eslintignore new file mode 100644 index 00000000000..33d672504b9 --- /dev/null +++ b/shared-data/.eslintignore @@ -0,0 +1,23 @@ +**/node_modules/** +**/coverage/** +**/dist/**/* +**/lib/**/* +**/build/** +**/venv/** +.opentrons_config +**/tsconfig*.json +**/vite.config.mts +# prettier +**/package.json +**/CHANGELOG.md + +# components library +storybook-static + +# python projects and tools +**/.mypy_cache/** +**/.pytest_cache/** + +# todo(mc, 2022-01-28): make these ignore rules more specific so we +# format data files like markdown and JSON inside python projects +python/** diff --git a/shared-data/Makefile b/shared-data/Makefile index a06c7979d9e..eaef0a370f6 100644 --- a/shared-data/Makefile +++ b/shared-data/Makefile @@ -9,20 +9,25 @@ tests ?= cov_opts ?= --coverage=true test_opts ?= +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 + # JavaScript targets .PHONY: lib-js @@ -34,6 +39,14 @@ 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: + yarn prettier --ignore-path .eslintignore --check $(FORMAT_FILE_GLOB) + # Python targets .PHONY: setup-py From 2722d12c60dd07874c82f431740f29227de9c722 Mon Sep 17 00:00:00 2001 From: Sanniti Date: Fri, 18 Oct 2024 11:32:40 -0400 Subject: [PATCH 2/4] remove irrelevant todo --- shared-data/.eslintignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/shared-data/.eslintignore b/shared-data/.eslintignore index 33d672504b9..45921e164ac 100644 --- a/shared-data/.eslintignore +++ b/shared-data/.eslintignore @@ -18,6 +18,4 @@ storybook-static **/.mypy_cache/** **/.pytest_cache/** -# todo(mc, 2022-01-28): make these ignore rules more specific so we -# format data files like markdown and JSON inside python projects python/** From 4ebe96b47f6a2e3298300bb2ba0ce0d170e8c8a0 Mon Sep 17 00:00:00 2001 From: Sanniti Date: Mon, 21 Oct 2024 16:02:33 -0400 Subject: [PATCH 3/4] address comments --- shared-data/.eslintignore | 21 --------------------- shared-data/Makefile | 20 +++++++++++++++++--- 2 files changed, 17 insertions(+), 24 deletions(-) delete mode 100644 shared-data/.eslintignore diff --git a/shared-data/.eslintignore b/shared-data/.eslintignore deleted file mode 100644 index 45921e164ac..00000000000 --- a/shared-data/.eslintignore +++ /dev/null @@ -1,21 +0,0 @@ -**/node_modules/** -**/coverage/** -**/dist/**/* -**/lib/**/* -**/build/** -**/venv/** -.opentrons_config -**/tsconfig*.json -**/vite.config.mts -# prettier -**/package.json -**/CHANGELOG.md - -# components library -storybook-static - -# python projects and tools -**/.mypy_cache/** -**/.pytest_cache/** - -python/** diff --git a/shared-data/Makefile b/shared-data/Makefile index eaef0a370f6..94cd26ffbf3 100644 --- a/shared-data/Makefile +++ b/shared-data/Makefile @@ -9,6 +9,9 @@ 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 @@ -28,6 +31,9 @@ clean: clean-py .PHONY: format format: format-js format-py +.PHONY: lint +lint: lint-js lint-py + # JavaScript targets .PHONY: lib-js @@ -41,11 +47,19 @@ build-ts: .PHONY: format-js format-js: - yarn prettier --ignore-path .eslintignore --write $(FORMAT_FILE_GLOB) + yarn prettier --ignore-path ../.eslintignore --write $(FORMAT_FILE_GLOB) .PHONY: lint-js -lint-js: - yarn prettier --ignore-path .eslintignore --check $(FORMAT_FILE_GLOB) +lint-js: lint-js-eslint lint-js-prettier + +.PHONY: lint-js-eslint +lint-js-eslint: + yarn eslint --ignore-path ../.eslintignore --quiet=$(quiet) --ignore-pattern "node_modules/" "**/*.@(js|ts|tsx)" + +.PHONY: lint-js-prettier +lint-js-prettier: + yarn prettier --ignore-path ../.eslintignore --check $(FORMAT_FILE_GLOB) + # Python targets From ada91b42518490b1404690243c23f6e07c8aa1a6 Mon Sep 17 00:00:00 2001 From: Sanniti Date: Wed, 23 Oct 2024 13:45:30 -0400 Subject: [PATCH 4/4] remove redundant ignore pattern --- shared-data/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-data/Makefile b/shared-data/Makefile index 94cd26ffbf3..2e972110c19 100644 --- a/shared-data/Makefile +++ b/shared-data/Makefile @@ -54,7 +54,7 @@ lint-js: lint-js-eslint lint-js-prettier .PHONY: lint-js-eslint lint-js-eslint: - yarn eslint --ignore-path ../.eslintignore --quiet=$(quiet) --ignore-pattern "node_modules/" "**/*.@(js|ts|tsx)" + yarn eslint --ignore-path ../.eslintignore --quiet=$(quiet) "**/*.@(js|ts|tsx)" .PHONY: lint-js-prettier lint-js-prettier: