https://github.com/haydenbleasel/ultracite
A robust linting preset for modern TypeScript apps.
https://github.com/haydenbleasel/ultracite
biome formatter linter
Last synced: 10 days ago
JSON representation
A robust linting preset for modern TypeScript apps.
- Host: GitHub
- URL: https://github.com/haydenbleasel/ultracite
- Owner: haydenbleasel
- License: mit
- Created: 2022-03-18T05:42:54.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-18T15:14:56.000Z (6 months ago)
- Last Synced: 2024-10-18T17:28:44.227Z (6 months ago)
- Topics: biome, formatter, linter
- Language: TypeScript
- Homepage: https://www.ultracite.dev/
- Size: 2.88 MB
- Stars: 47
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: license.md
- Security: SECURITY.md
Awesome Lists containing this project
- stars - ultracite
README
# Ultracite
Ultracite is a robust linting configuration for modern TypeScript apps, built on [Biome](https://biomejs.dev/). It is incredibly opinionated and strict, enforcing the maximum amount of type safety and code quality. Once Ultracite is set up, it will automatically lint, fix and format your code on save.
![]()
![]()
![]()
![]()
## Installation
### Automatic Installation
Run the command below to install and initialize Ultracite in the current directory:
```sh
npx ultracite init
```### Manual Installation
Run the command below to install Ultracite:
```sh
pnpm add -D --save-exact ultracite @biomejs/biome
```If you're running [VS Code](https://code.visualstudio.com/), ensure you have the following extensions installed:
```sh
code --install-extension biomejs.biome
code --install-extension bradlc.vscode-tailwindcss
```## Setup
Create a `biome.json` with the following contents:
```json
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"extends": ["ultracite"]
}
```Ultracite is designed to be used with [VS Code](https://code.visualstudio.com/). Create a `.vscode/settings.json` file with the following contents to enable full formatting and fixing on save:
```json
{
"typescript.tsdk": "node_modules/typescript/lib",
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"emmet.showExpandedAbbreviation": "never",
"editor.codeActionsOnSave": {
"source.fixAll.biome": "explicit",
"source.organizeImports.biome": "explicit"
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[json]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[jsonc]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
}
}
```Lastly, ensure your `tsconfig.json` (if it exists) has `strictNullChecks` enabled.
```json
{
"compilerOptions": {
"strictNullChecks": true
}
}
```## Usage
Ultracite will automatically lint, fix and format your code on save. If you'd like to run Ultracite manually, you can do so with the following command:
```sh
npx ultracite
```## Configuration
While Ultracite is designed to be zero-config, you can modify anything you'd like in your `biome.json` file. For example, to enable the `noAutofocus` rule, you can do the following:
```json
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"extends": ["ultracite"],
"linter": {
"rules": {
"a11y": {
"noAutofocus": "off"
}
}
}
}
```You can also disable rules on a per-line basis by adding a comment to the end of the line:
```tsx
// biome-ignore lint/security/noDangerouslySetInnerHtml: I do what I want mate.
```## Notes
Ultracite was previously built on [ESLint](https://eslint.org/), [Prettier](https://prettier.io/) and [Stylelint](https://stylelint.io/). If you'd like to use that stack, you can install a compatible version of Ultracite with the following command:
```sh
pnpm add -D ultracite@3 eslint@8 prettier stylelint typescript jest
```