rawstyle-eslint
v0.2.0
Published
🧹 CSS formatting with autofixes for Rawstyle
Maintainers
Readme
🔥 Features
- ✏️ 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
⚙️ Setup
- 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.cssfile 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-eslintplugin to enable ESLint support for.ts(x)files.
🧩 Rules
💼 – set in the recommended configuration
🔧 – automatically fixable
| Rule Name | Description | 💼 | 🔧 |
|-----------|-------------|----|-----|
| indent | Enforce consistent indentation | ✔️ | ✔️ |
| no-trailing-whitespace | Disallow trailing whitespace | ✔️ | ✔️ |
