Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/skrulling/vite-plugin-biome
Vite plugin for using the Biome linter
https://github.com/skrulling/vite-plugin-biome
Last synced: 1 day ago
JSON representation
Vite plugin for using the Biome linter
- Host: GitHub
- URL: https://github.com/skrulling/vite-plugin-biome
- Owner: skrulling
- License: mit
- Created: 2023-12-22T14:56:59.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-03-13T20:55:10.000Z (8 months ago)
- Last Synced: 2024-04-23T21:28:53.800Z (7 months ago)
- Language: TypeScript
- Size: 54.7 KB
- Stars: 17
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-vite - vite-plugin-biome - Biome linter. (Plugins / Framework-agnostic Plugins)
- awesome-vite - vite-plugin-biome - Biome linter. (Plugins / Framework-agnostic Plugins)
README
# Vite Plugin Biome
This is a Vite plugin for integrating the [Biome](https://biomejs.dev/) linter into your Vite project. It allows you to lint, format, or check your project files using Biome directly within the Vite build process.
It is much faster than eslint.## Features
- Integrates Biome linter, formatter, and checker into the Vite build process.
- Supports different modes: linting, formatting, and checking.
- Prints Biome output to the console.
- Configurable to apply fixes and handle errors.
- Reacts to hot reload## Installation
```bash
npm install vite-plugin-biome @biomejs/biome
```## Usage
First, add the plugin to your `vite.config.js` file. You can specify the mode (`lint`, `format`, `check`), the files to be processed, and other options.
### Basic Usage
For basic linting:
```javascript
import biomePlugin from 'vite-plugin-biome';export default {
plugins: [biomePlugin()],
};
```### Advanced Usage
#### Linting
To lint files without applying fixes:
```javascript
import biomePlugin from 'vite-plugin-biome';export default {
plugins: [biomePlugin({
mode: 'lint',
files: '.' // This is the default, it will lint all files in a project
})],
};
```#### Formatting
To format and write changes to files:
```javascript
import biomePlugin from 'vite-plugin-biome';export default {
plugins: [biomePlugin({
mode: 'format',
files: 'src/**/*.js', // Format only JavaScript files in src
applyFixes: true
})],
};
```#### Checking
To perform both linting and formatting with applied fixes:
```javascript
import biomePlugin from 'vite-plugin-biome';export default {
plugins: [biomePlugin({
mode: 'check',
files: '.',
applyFixes: true
})],
};
```### Options
| Option | Description | Values | Default |
|---------------|----------------------------------------------|---------------------|---------|
| `mode` | The operation mode of the plugin | `lint`, `format`, `check` | `lint` |
| `files` | File or glob pattern to process | e.g., `'src/**/*.js'`| `'.'` |
| `applyFixes` | Whether to apply fixes automatically | `true`, `false` | `false` |
| `failOnError` | Whether to fail the build on lint errors | `true`, `false` | `false` |## License
[MIT LICENSE](LICENSE)
[GitHub](https://github.com/skrulling/vite-plugin-biome)