diff --git a/README.md b/README.md index 5b8763c..5a3af35 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ I use this config in all my projects. No need to copy/paste anymore 😄 ## Supported tools - [x] Prettier -- [ ] ESLint +- [x] Biome (replaces ESLint + Prettier) - [x] Typescript ## Install @@ -47,6 +47,43 @@ npx prettier -c ./ # Check if there is some files to update npx prettier -w ./ # Update files ``` +### Biome + +[Biome](https://biomejs.dev/) is a fast formatter and linter that can replace both Prettier and ESLint. + +```json5 +// biome.json +{ + "extends": ["@decampsrenan/config/biome"] + // Override with your custom needs here +} +``` + +Or if you need more control on the settings: + +```json5 +// biome.json +{ + "extends": ["@decampsrenan/config/biome"], + "linter": { + "rules": { + "suspicious": { + "noConsoleLog": "off" // Example: disable console.log warnings + } + } + } +} +``` + +Then run the following commands: + +```sh +npx @biomejs/biome check ./ # Check formatting and linting +npx @biomejs/biome check --write ./ # Fix issues automatically +npx @biomejs/biome lint ./ # Lint only +npx @biomejs/biome format ./ # Format only +``` + ### TSConfig ```json5 diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..20befee --- /dev/null +++ b/biome.json @@ -0,0 +1,86 @@ +{ + "$schema": "https://biomejs.dev/schemas/2.3.11/schema.json", + "vcs": { + "enabled": true, + "clientKind": "git", + "useIgnoreFile": true + }, + "assist": { + "actions": { + "source": { + "organizeImports": { + "level": "on", + "options": { + "groups": [ + ["react", "react-dom", "react-dom/**", "react-*", "react-*/**"], + ":BLANK_LINE:", + ["@plasmohq/*", "@plasmohq/**"], + ":BLANK_LINE:", + ":PACKAGE:", + ":BLANK_LINE:", + ":ALIAS:", + ":BLANK_LINE:", + ":PACKAGE_WITH_PROTOCOL:", + ":BLANK_LINE:", + ":PATH:" + ] + } + } + } + } + }, + "formatter": { + "enabled": true, + "formatWithErrors": false, + "indentStyle": "space", + "indentWidth": 2, + "lineWidth": 100, + "lineEnding": "lf", + "attributePosition": "auto" + }, + "javascript": { + "formatter": { + "semicolons": "always", + "quoteStyle": "single", + "jsxQuoteStyle": "double", + "quoteProperties": "asNeeded", + "trailingCommas": "all", + "bracketSpacing": true, + "bracketSameLine": false, + "arrowParentheses": "always", + "attributePosition": "auto" + } + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true, + "correctness": { + "noUnusedImports": "error", + "noUnusedVariables": "error", + "useExhaustiveDependencies": "warn", + "useHookAtTopLevel": "error" + }, + "style": { + "noNonNullAssertion": "warn", + "useConst": "error", + "useImportType": "error", + "useNodejsImportProtocol": "error" + }, + "suspicious": { + "noExplicitAny": "warn", + "noConsoleLog": "warn" + }, + "complexity": { + "noForEach": "off", + "useLiteralKeys": "off" + } + } + }, + "json": { + "formatter": { + "indentStyle": "tab", + "trailingCommas": "none" + } + } +} diff --git a/package.json b/package.json index 66ac8ab..66d8639 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "exports": { "./prettier-default": "./prettier-default.mjs", "./prettier-astro": "./prettier-astro.mjs", - "./tsconfig": "./tsconfig.json" + "./tsconfig": "./tsconfig.json", + "./biome": "./biome.json" }, "scripts": { "test": "true", @@ -16,6 +17,11 @@ "keywords": [ "prettier", "prettier-config", + "biome", + "biome-config", + "eslint", + "linter", + "formatter", "config", "style", "typescript",