- ✏️ Indentation: enforce consistent indentation in CSS templates
- 🧹 Trailing Whitespace: remove trailing whitespace in CSS blocks
- ⚡ Auto-fixable: seamless integration with editor and CLI autofix
- 💎 Vanilla CSS Support: the plugin can also be applied to regular
.cssfiles
- Install the plugin:
pnpm add -D rawstyle-eslint- Add the plugin to your ESLint configuration:
import rawstyle from 'rawstyle-eslint'
// ...
export default defineConfig([
// via the recommended config:
{
name: 'Rawstyle Rules',
files: ['**/*.ts?(x)'],
extends: [rawstyle.configs.recommended],
// plugins: { rawstyle }, // not necessary when using the recommended config
rules: { 'rawstyle/indent': 'off' }, // can still override rules here
},
// or directly:
{
name: 'Rawstyle Rules',
files: ['**/*.ts?(x)'],
plugins: { rawstyle },
rules: {
'rawstyle/indent': 'error',
'rawstyle/no-trailing-whitespace': 'error',
},
},
// for vanilla CSS files:
{
name: 'CSS Rules',
files: ['**/*.css'],
language: 'rawstyle/css', // do not specify this if you're using
// the `@eslint/css` plugin and have already set
// the `language` for `**/*.css` files
extends: [rawstyle.configs.recommended],
},
])Warning
Do not mix .ts(x) and .css file patterns in the same config object (e.g. files: ['**/*.{ts,tsx,css}']) — CSS files require a different parser.
Note
Make sure you are using the @typescript-eslint plugin to enable ESLint support for .ts(x) files.
💼 – set in the recommended configuration
🔧 – automatically fixable
| Rule Name | Description | 💼 | 🔧 |
|---|---|---|---|
indent |
Enforce consistent indentation | ✔️ | ✔️ |
no-trailing-whitespace |
Disallow trailing whitespace | ✔️ | ✔️ |
MIT License © 2026 Rawstyle

