From 953b05948ec4e6fe5151b6f768ad2de03f0c9d5f Mon Sep 17 00:00:00 2001 From: Lam Nguyen Date: Fri, 21 Feb 2025 04:22:13 -0800 Subject: [PATCH] feat: added biome + makefile --- .gitignore | 1 - .vscode/settings.json | 11 ++++++++ Makefile | 28 +++++++++++++++++++ biome.json | 65 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json create mode 100644 Makefile create mode 100644 biome.json diff --git a/.gitignore b/.gitignore index a807f0d9..1c776a89 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ ############### Thumbs.db .DS_Store -.vscode *.code-workspace # Logs # diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..3977c351 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,11 @@ +{ + "editor.defaultFormatter": "biomejs.biome", + "css.validate": false, + "editor.codeActionsOnSave": { + "source.fixAll.biome": "explicit" + }, + "[javascript][css][json]": { + "editor.defaultFormatter": "biomejs.biome", + "editor.formatOnSave": true + } +} \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..9f4bcd92 --- /dev/null +++ b/Makefile @@ -0,0 +1,28 @@ +BIOME_BASE_CMD := npx @biomejs/biome +BIOME_CONFIG_PATH := --config-path="biome.json" +WRITE_FLAG := --write + +.PHONY: list help +list help:: + $(info Available Make targets:) + @echo "" + @echo " list | help: Print these available make targets" + @echo "" + @echo " biome-format: Runs the biome formatter." + @echo " biome-lint: Runs the biome linter." + @echo " biome-all: Runs both the lint and formatting commands." + @echo " (Set BIOME_ARGS to add additional arguments to biome command (ex: make biome-all BIOME_ARGS=write))" + +.PHONY: biome-format biome-lint biome-all +BIOME_ARGS ?= +FLAG := +ifeq ($(BIOME_ARGS), write) + FLAG := $(WRITE_FLAG) +endif + +biome-format: + $(BIOME_BASE_CMD) format $(BIOME_CONFIG_PATH) $(FLAG) +biome-lint: + $(BIOME_BASE_CMD) lint $(BIOME_CONFIG_PATH) $(FLAG) +biome-all: + $(BIOME_BASE_CMD) check $(BIOME_CONFIG_PATH) $(FLAG) \ No newline at end of file diff --git a/biome.json b/biome.json new file mode 100644 index 00000000..90bbda54 --- /dev/null +++ b/biome.json @@ -0,0 +1,65 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", + "vcs": { + "enabled": false, + "clientKind": "git", + "useIgnoreFile": false + }, + "files": { + "ignoreUnknown": false, + "ignore": [ + ".vscode/", + "**/*.min.js", + "**/*.standalone.js", + "kube.js", + + "**/css/docs-nginx-com/*.css", + "**/css/inter/*.css", + "**/fontawesome/*.css", + "**/static/*.css", + "**/bootstrap*.css", + "**/*.min.css", + "**/coveo.css", + "**/f5-hugo.css", + "**/highlight.css", + "**/*-overrides.css" + ] + }, + "formatter": { + "enabled": true, + "indentStyle": "space" + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true, + "complexity": { + "noForEach": "off" + }, + "style": { + "useTemplate": "off" + }, + "nursery": { + "noDuplicateProperties": "error" + }, + "suspicious": { + "noEmptyBlock": "error" + }, + "correctness": { + "noUnknownUnit": "error" + } + } + }, + "javascript": { + "formatter": { + "quoteStyle": "single", + "trailingCommas": "es5", + "semicolons": "always" + } + }, + "css": { + "formatter": { + "quoteStyle": "double" + } + } +} \ No newline at end of file