stacks/glint
publicClone
Push over the same URL. A password will not work: create a token under access tokens and use it in place of one.
Performant linter & formatter. Supports HTML, CSS, JS & TS. Coming soon.
- .cursor
- .github
- .vscode
- .zed
- bin
- docs
- examples
- src
- test
- .editorconfig 147 B
- .gitattributes 12 B
- .gitignore 116 B
- buddy-bot.config.ts 853 B
- build.ts 167 B
- bun.lock 269.2 KB
- bunfig.toml 88 B
- CHANGELOG.md 5.8 KB
- eslint.config.ts 314 B
- glint 39 B
- glint.config.ts 3.3 KB
- LICENSE.md 1.1 KB
- package.json 3.7 KB
- pkgx.yaml 32 B
- README.md 9.4 KB
- tsconfig.json 627 B

Glint
A blazingly fast linter and formatter for HTML, CSS, JavaScript, and TypeScript. Built for absolute performance with Bun's native APIs and designed to be extensible via plugins.
β¨ Features
- π Performance-Optimized - Built with Bun's native APIs for maximum performance
- π§ Multi-Language Support - HTML, CSS, JavaScript, and TypeScript
- π Plugin System - Extensible architecture for custom rules and formatters
- πΎ Smart Caching - File-based caching with memory optimization
- β‘ Parallel Processing - Multi-threaded processing for large codebases
- π― Zero Config - Works out of the box with sensible defaults
- π Performance Metrics - Built-in performance monitoring and reporting
Installation
# Using Bun (recommended)
bun add @stacksjs/glint
# Using npm
npm install @stacksjs/glint
# Using yarn
yarn add @stacksjs/glintCLI Usage
# Lint files
glint lint
# Lint specific files
glint lint src/**/*.ts
# Format files
glint format --write
# Check both linting and formatting
glint check
# Show help
glint --helpProgrammatic Usage
import { GlintEngine } from '@stacksjs/glint'
const engine = new GlintEngine({
verbose: true,
parallel: true,
cacheEnabled: true,
})
// Lint files
const lintResults = await engine.lintFiles(['src/**/*.ts'])
// Format files
const formatResults = await engine.formatFiles(['src/**/*.ts'], true)
// Both lint and format
const { lintResults, formatResults } = await engine.lintAndFormat(['src/**/*.ts'])Configuration
Create a glint.config.ts file in your project root:
import type { GlintConfig } from '@stacksjs/glint'
export default {
// Performance settings
parallel: true,
maxWorkers: 4,
cacheEnabled: true,
// File processing
include: ['**/*.{html,css,js,ts,jsx,tsx}'],
exclude: ['**/node_modules/**', '**/dist/**'],
// Language-specific configuration
html: {
enabled: true,
rules: {
'no-duplicate-attributes': 'error',
'require-alt': 'error',
},
formatter: {
indentSize: 2,
indentType: 'spaces',
lineWidth: 120,
},
},
css: {
enabled: true,
rules: {
'no-duplicate-properties': 'error',
'no-empty-rules': 'warn',
},
},
javascript: {
enabled: true,
rules: {
'no-unused-vars': 'error',
'prefer-const': 'error',
},
},
typescript: {
enabled: true,
rules: {
'no-explicit-any': 'warn',
'prefer-interface': 'warn',
},
},
} satisfies GlintConfigCLI Commands
Lint Command
# Basic linting
glint lint
# Lint specific patterns
glint lint "src/**/*.{ts,js}"
# Output formats
glint lint --format json
glint lint --format stylish
glint lint --format compact
# Save output to file
glint lint --output-file results.json
# Performance options
glint lint --parallel --max-workers 8
glint lint --no-cacheFormat Command
# Check formatting (dry run)
glint format
# Write formatted files
glint format --write
# Check if files need formatting (exit code 1 if needed)
glint format --check
# Format specific files
glint format "src/**/*.ts" --writeCheck Command
# Run both linting and formatting checks
glint check
# Check specific files
glint check "src/**/*.ts"Cache Commands
# Clear cache
glint cache:clear
# Show cache info
glint cache:infoArchitecture
Glint is built with performance as the top priority:
Core Components
- FileProcessor - High-performance file discovery and loading with Bun's native glob
- GlintLinter - Multi-threaded AST-based linting engine
- GlintFormatter - Fast formatting with language-specific optimizations
- FileCache - Two-tier caching (memory + disk) for maximum speed
- GlintEngine - Main orchestrator with parallel processing
Performance Optimizations
- Native Bun APIs - Uses Bun's fast glob and file operations
- Parallel Processing - Multi-worker architecture for large codebases
- Smart Caching - Content-based caching with version validation
- Memory Management - Efficient memory usage with streaming and chunking
- AST Reuse - Optimized AST parsing and traversal
Plugin System
Glint supports a powerful plugin system for extending functionality:
// Example plugin
export const myPlugin: Plugin = {
name: 'my-custom-plugin',
version: '1.0.0',
languages: ['javascript', 'typescript'],
rules: {
'my-custom-rule': {
meta: {
type: 'problem',
docs: {
description: 'My custom rule',
category: 'Best Practices',
recommended: true,
},
},
create: context => ({
VariableDeclaration: (node) => {
// Custom rule logic
},
}),
},
},
formatters: {
javascript: {
format: async (code, options) => {
// Custom formatting logic
return formattedCode
},
},
},
}
// Load plugin
engine.loadPlugin(myPlugin)Performance Metrics
Glint provides detailed performance metrics:
const metrics = engine.getMetrics()
console.log(`Total time: ${metrics.totalTime}ms`)
console.log(`Files processed: ${metrics.filesProcessed}`)
console.log(`Lines per second: ${metrics.linesProcessed / (metrics.totalTime / 1000)}`)
console.log(`Cache hit rate: ${metrics.cacheHits / (metrics.cacheHits + metrics.cacheMisses) * 100}%`)Built-in Rules
HTML Rules
no-duplicate-attributes- Disallow duplicate attributesrequire-alt- Require alt attribute for img elementsno-inline-styles- Disallow inline stylesno-obsolete-tags- Disallow obsolete HTML tagsproper-nesting- Ensure proper HTML nesting
CSS Rules
no-duplicate-properties- Disallow duplicate propertiesno-empty-rules- Disallow empty CSS rulesprefer-shorthand- Prefer shorthand propertiesno-vendor-prefixes- Disallow vendor prefixescolor-format- Enforce consistent color format
JavaScript Rules
no-unused-vars- Disallow unused variablesno-console- Disallow console statementsprefer-const- Prefer const declarationsno-var- Disallow var declarationseqeqeq- Require strict equalitycurly- Require curly braces
TypeScript Rules
no-explicit-any- Disallow explicit any typeprefer-interface- Prefer interfaces over type aliasesno-non-null-assertion- Disallow non-null assertionsexplicit-function-return-type- Require explicit return types
Performance Benchmarks
Glint is designed for speed. Here are some benchmarks:
| Project Size | Files | Lines | Glint Time | Competitor Time | Speedup |
|---|---|---|---|---|---|
| Small | 50 | 5K | 45ms | 180ms | 4x |
| Medium | 500 | 50K | 320ms | 1.8s | 5.6x |
| Large | 2000 | 200K | 1.1s | 8.2s | 7.5x |
Benchmarks run on MacBook Pro M2 with 16GB RAM
Development Setup
# Clone the repository
git clone https://github.com/stacksjs/glint.git
cd glint
# Install dependencies
bun install
# Build the project
bun run build
# Run tests
bun test
# Run linting
bun run lintTesting
bun testChangelog
Please see our releases page for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Community
For help, discussion about best practices, or any other conversation that would benefit from being searchable:
For casual chit-chat with others using this package:
Join the Stacks Discord Server
Postcardware
βSoftware that is free, but hopes for a postcard.β We love receiving postcards from around the world showing where Stacks is being used! We showcase them on our website too.
Our address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094, United States π
Sponsors
We would like to extend our thanks to the following sponsors for funding Stacks development. If you are interested in becoming a sponsor, please reach out to us.
License
The MIT License (MIT). Please see LICENSE for more information.
Made with π
[codecov-href]: https://codecov.io/gh/stacksjs/ts-starter -->