|
| 1 | +# biome-config-godaddy |
| 2 | + |
| 3 | +Base Biome configuration for JavaScript applications officially used at GoDaddy. |
| 4 | + |
| 5 | +This configuration provides a fast, Rust-based alternative to ESLint and Prettier using [Biome][biome]. It implements the same linting and formatting standards as GoDaddy's ESLint configurations, ensuring consistency across projects while delivering superior performance. |
| 6 | + |
| 7 | +**Important**: This package requires Biome 2.2.0 or newer. The configuration utilizes the latest linting rules introduced in Biome 2.2.0 that provide feature parity with GoDaddy's ESLint configurations. Earlier versions of Biome will not support all the rules used in this configuration. |
| 8 | + |
| 9 | +Have a question or comment? [Open an issue!][issues] |
| 10 | + |
| 11 | +#### Example basic setup |
| 12 | + |
| 13 | +```json |
| 14 | +{ |
| 15 | + "$schema": "https://biomejs.dev/schemas/2.2.0/schema.json", |
| 16 | + "extends": ["biome-config-godaddy/biome.json"] |
| 17 | +} |
| 18 | +``` |
| 19 | + |
| 20 | +## Installation |
| 21 | + |
| 22 | +Install the package and its peer dependency using pnpm: |
| 23 | + |
| 24 | +```sh |
| 25 | +pnpm install biome-config-godaddy @biomejs/biome --save-dev |
| 26 | +``` |
| 27 | + |
| 28 | +Or with npm: |
| 29 | + |
| 30 | +```sh |
| 31 | +npm install biome-config-godaddy @biomejs/biome --save-dev |
| 32 | +``` |
| 33 | + |
| 34 | +## Configuration |
| 35 | + |
| 36 | +### Options |
| 37 | + |
| 38 | +This package provides two configuration files: |
| 39 | + |
| 40 | +- `biome.json` - Base configuration for JavaScript projects |
| 41 | +- `biome-ts.json` - Enhanced configuration for TypeScript projects |
| 42 | + |
| 43 | +Both configurations include: |
| 44 | + |
| 45 | +- **Formatter settings**: 2-space indentation, 130 character line width, LF line endings |
| 46 | +- **Linter rules**: Comprehensive rules aligned with `eslint-config-godaddy` standards |
| 47 | +- **Fast performance**: Rust-based implementation for improved build times |
| 48 | + |
| 49 | +#### Example JavaScript project |
| 50 | + |
| 51 | +Create a `biome.json` file in your project root: |
| 52 | + |
| 53 | +```json |
| 54 | +{ |
| 55 | + "$schema": "https://biomejs.dev/schemas/2.2.0/schema.json", |
| 56 | + "extends": ["biome-config-godaddy/biome.json"] |
| 57 | +} |
| 58 | +``` |
| 59 | + |
| 60 | +#### Example TypeScript project |
| 61 | + |
| 62 | +For TypeScript projects, use the TypeScript-specific configuration: |
| 63 | + |
| 64 | +```json |
| 65 | +{ |
| 66 | + "$schema": "https://biomejs.dev/schemas/2.2.0/schema.json", |
| 67 | + "extends": ["biome-config-godaddy/biome-ts.json"] |
| 68 | +} |
| 69 | +``` |
| 70 | + |
| 71 | +#### Example with custom overrides |
| 72 | + |
| 73 | +Extend the base configuration and add project-specific rules: |
| 74 | + |
| 75 | +```json |
| 76 | +{ |
| 77 | + "$schema": "https://biomejs.dev/schemas/2.2.0/schema.json", |
| 78 | + "extends": ["biome-config-godaddy/biome.json"], |
| 79 | + "linter": { |
| 80 | + "rules": { |
| 81 | + "suspicious": { |
| 82 | + "noConsoleLog": "off" |
| 83 | + }, |
| 84 | + "style": { |
| 85 | + "useNodejsImportProtocol": "error" |
| 86 | + } |
| 87 | + } |
| 88 | + } |
| 89 | +} |
| 90 | +``` |
| 91 | + |
| 92 | +#### Example package.json scripts |
| 93 | + |
| 94 | +Add these scripts to your `package.json` for common development workflows: |
| 95 | + |
| 96 | +```json |
| 97 | +{ |
| 98 | + "scripts": { |
| 99 | + "lint": "biome lint .", |
| 100 | + "lint:fix": "biome lint --write .", |
| 101 | + "format": "biome format --write .", |
| 102 | + "format:check": "biome format .", |
| 103 | + "check": "biome check --write .", |
| 104 | + "check:ci": "biome check ." |
| 105 | + } |
| 106 | +} |
| 107 | +``` |
| 108 | + |
| 109 | +## Commands |
| 110 | + |
| 111 | +### `format` command |
| 112 | + |
| 113 | +Formats all files in the current directory and subdirectories according to GoDaddy style rules. |
| 114 | + |
| 115 | +#### Example `format` usage |
| 116 | + |
| 117 | +```sh |
| 118 | +# Format and write changes |
| 119 | +biome format --write . |
| 120 | + |
| 121 | +# Check formatting without making changes |
| 122 | +biome format . |
| 123 | +``` |
| 124 | + |
| 125 | +### `lint` command |
| 126 | + |
| 127 | +Analyzes code for potential issues using GoDaddy's linting standards. |
| 128 | + |
| 129 | +#### Example `lint` usage |
| 130 | + |
| 131 | +```sh |
| 132 | +# Lint all files |
| 133 | +biome lint . |
| 134 | + |
| 135 | +# Lint with auto-fix |
| 136 | +biome lint --write . |
| 137 | + |
| 138 | +# Lint specific files |
| 139 | +biome lint src/**/*.js |
| 140 | +``` |
| 141 | + |
| 142 | +### `check` command |
| 143 | + |
| 144 | +Combines linting and formatting in a single operation for comprehensive code quality checks. |
| 145 | + |
| 146 | +#### Example `check` usage |
| 147 | + |
| 148 | +```sh |
| 149 | +# Check and fix all issues |
| 150 | +biome check --write . |
| 151 | + |
| 152 | +# Dry run to see what would change |
| 153 | +biome check . |
| 154 | + |
| 155 | +# Check specific directories |
| 156 | +biome check src/ tests/ |
| 157 | +``` |
| 158 | + |
| 159 | +## Lifecycles |
| 160 | + |
| 161 | +### `pre-commit` |
| 162 | + |
| 163 | +Integrate with Git hooks to ensure code quality before commits. |
| 164 | + |
| 165 | +#### Example `pre-commit` setup |
| 166 | + |
| 167 | +```json |
| 168 | +{ |
| 169 | + "scripts": { |
| 170 | + "pre-commit": "biome check --write --staged" |
| 171 | + } |
| 172 | +} |
| 173 | +``` |
| 174 | + |
| 175 | +### Continuous integration |
| 176 | + |
| 177 | +Validate code quality in CI pipelines without making changes. |
| 178 | + |
| 179 | +#### Example CI validation |
| 180 | + |
| 181 | +```json |
| 182 | +{ |
| 183 | + "scripts": { |
| 184 | + "ci:lint": "biome check .", |
| 185 | + "ci:format": "biome format ." |
| 186 | + } |
| 187 | +} |
| 188 | +``` |
| 189 | + |
| 190 | +## How it works |
| 191 | + |
| 192 | +This Biome configuration mirrors the linting and formatting standards established by GoDaddy's ESLint configurations (`eslint-config-godaddy` and `eslint-config-godaddy-typescript`). Biome, written in Rust, provides the same code quality enforcement with improved performance compared to equivalent ESLint + Prettier setups. |
| 193 | + |
| 194 | +The configuration enforces GoDaddy's JavaScript style guide including 2-space indentation, 130-character line limits, consistent semicolon usage, and comprehensive linting rules for code correctness, complexity management, and style consistency. The formatter ensures consistent code appearance across all team members. |
| 195 | + |
| 196 | +Unlike traditional ESLint + Prettier combinations, Biome provides integrated linting and formatting in a single tool, eliminating configuration conflicts and reducing the number of dependencies in your project. The configuration automatically handles JavaScript and TypeScript files for different development environments. |
| 197 | + |
| 198 | +## Related Packages |
| 199 | + |
| 200 | +This Biome configuration is designed to be a drop-in replacement for GoDaddy's ESLint configurations: |
| 201 | + |
| 202 | +- [`eslint-config-godaddy`][eslint-base] - Base ESLint config (equivalent to `biome.json`) |
| 203 | +- [`eslint-config-godaddy-typescript`][eslint-typescript] - ESLint config for TypeScript (equivalent to `biome-ts.json`) |
| 204 | +- [`eslint-config-godaddy-react`][eslint-react] - ESLint config for React applications |
| 205 | +- [`eslint-config-godaddy-react-typescript`][eslint-react-ts] - ESLint config for React with TypeScript |
| 206 | + |
| 207 | +Teams can migrate from ESLint configurations to Biome while maintaining the same code quality standards and style guidelines that GoDaddy has established across its engineering organization. |
| 208 | + |
| 209 | +## License |
| 210 | + |
| 211 | +[MIT][license] |
| 212 | + |
| 213 | +[biome]: https://biomejs.dev/ |
| 214 | +[issues]: https://github.com/godaddy/javascript/issues/new |
| 215 | +[license]: https://github.com/godaddy/javascript/blob/main/LICENSE |
| 216 | +[eslint-base]: https://www.npmjs.com/package/eslint-config-godaddy |
| 217 | +[eslint-typescript]: https://www.npmjs.com/package/eslint-config-godaddy-typescript |
| 218 | +[eslint-react]: https://www.npmjs.com/package/eslint-config-godaddy-react |
| 219 | +[eslint-react-ts]: https://www.npmjs.com/package/eslint-config-godaddy-react-typescript |
| 220 | + |
0 commit comments