diff --git a/packages/dev/biome-config/configs/biome-base.jsonc b/packages/dev/biome-config/configs/biome-base.jsonc index 3d520d6fd..f39feee23 100644 --- a/packages/dev/biome-config/configs/biome-base.jsonc +++ b/packages/dev/biome-config/configs/biome-base.jsonc @@ -1,7 +1,11 @@ { "$schema": "../node_modules/@biomejs/biome/configuration_schema.json", - "organizeImports": { - "enabled": true + "assist": { + "actions": { + "source": { + "organizeImports": "on" + } + } }, "json": { "formatter": { @@ -25,8 +29,7 @@ } }, "files": { - "include": ["./**/*.ts", "./**/*.mts", "./**/*.tsx", "./**/*.json", "./**/*.jsonc"], - "ignore": ["./dist", "./coverage", "./node_modules"] + "includes": ["**/*.ts", "**/*.mts", "**/*.tsx", "**/*.json", "**/*.jsonc", "!dist", "!coverage", "!node_modules"] }, "formatter": { "enabled": true, @@ -51,7 +54,7 @@ "noUndeclaredVariables": "error" }, "suspicious": { - "noConsoleLog": "error", + "noConsole": "error", "useAwait": "error" }, "complexity": { @@ -67,7 +70,7 @@ }, "overrides": [ { - "include": ["./**/*.spec.ts", "./**/*.test.ts", "./**/*.test.tsx", "**/test/**/*"], + "includes": ["./**/*.spec.ts", "./**/*.test.ts", "./**/*.test.tsx", "**/test/**/*"], "javascript": { // Allow Vitest globals in test files "globals": [ diff --git a/packages/dev/biome-config/configs/biome-frontend.jsonc b/packages/dev/biome-config/configs/biome-frontend.jsonc index 3606b2074..79bdbe8b0 100644 --- a/packages/dev/biome-config/configs/biome-frontend.jsonc +++ b/packages/dev/biome-config/configs/biome-frontend.jsonc @@ -11,7 +11,7 @@ } }, "files": { - "include": ["**/*.css"] + "includes": ["**/*.css"] }, "css": { "parser": { @@ -29,5 +29,6 @@ "useHookAtTopLevel": "error" } } - } + }, + "plugins": ["./node_modules/@lokalise/biome-config/configs/plugins/no-manual-z-index.grit"] } diff --git a/packages/dev/biome-config/configs/biome-package.jsonc b/packages/dev/biome-config/configs/biome-package.jsonc index 5f25f61c4..a1316dd91 100644 --- a/packages/dev/biome-config/configs/biome-package.jsonc +++ b/packages/dev/biome-config/configs/biome-package.jsonc @@ -1,5 +1,5 @@ { - "$schema": "../../../node_modules/@biomejs/biome/configuration_schema.json", + "$schema": "../node_modules/@biomejs/biome/configuration_schema.json", "extends": ["./biome-base.jsonc"], "linter": { "rules": { diff --git a/packages/dev/biome-config/configs/plugins/no-manual-z-index.grit b/packages/dev/biome-config/configs/plugins/no-manual-z-index.grit new file mode 100644 index 000000000..a240ffdb3 --- /dev/null +++ b/packages/dev/biome-config/configs/plugins/no-manual-z-index.grit @@ -0,0 +1,19 @@ +language css; + +// Match the values assigned to z-index properties +`z-index: $zIndexValue;` where { + + // Check that the value is using the design library for z-index values + // we negate the result as failure to comply with the design library should result in the warning + not $zIndexValue <: r"^var\(--lok-z-index-\S+\)$", + + // This is generating the helpful error report that points out any violation + // it's a built in function that adds the code with arrows and a description of what's wrong + register_diagnostic( + span = $zIndexValue, + message = "lokalise/plugin/noManualZIndex :: z-index values should be set using the design library. Please use refer to https://lokalise.github.io/louis/?path=/docs/foundations-z-index--docs", + + // This is only a warning for now because I can't find a way to biome-ignore the error produced by plugins + severity = "warn", + ), +} \ No newline at end of file diff --git a/packages/dev/biome-config/package.json b/packages/dev/biome-config/package.json index 99e2f1fd2..eae25dc4b 100644 --- a/packages/dev/biome-config/package.json +++ b/packages/dev/biome-config/package.json @@ -22,6 +22,6 @@ }, "private": false, "devDependencies": { - "@biomejs/biome": "^1.9.4" + "@biomejs/biome": "^2.0.0-beta" } }