https://github.com/rawstylecss/rawstyle-eslint
🧹 CSS formatting inside Rawstyle templates
https://github.com/rawstylecss/rawstyle-eslint
css-in-js eslint eslint-plugin rawstyle rawstyle-eslint
Last synced: 4 months ago
JSON representation
🧹 CSS formatting inside Rawstyle templates
- Host: GitHub
- URL: https://github.com/rawstylecss/rawstyle-eslint
- Owner: rawstylecss
- License: mit
- Created: 2026-01-26T12:16:48.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-02-09T12:16:07.000Z (4 months ago)
- Last Synced: 2026-02-09T17:24:36.204Z (4 months ago)
- Topics: css-in-js, eslint, eslint-plugin, rawstyle, rawstyle-eslint
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/rawstyle-eslint
- Size: 167 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
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 `.css` files
## ⚙️ Setup
1. Install the plugin:
```bash
pnpm add -D rawstyle-eslint
```
2. Add the plugin to your ESLint configuration:
```ts
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.
## 🧩 Rules
💼 – set in the `recommended` configuration
🔧 – automatically fixable
| Rule Name | Description | 💼 | 🔧 |
|-----------|-------------|----|-----|
| `indent` | Enforce consistent indentation | ✔️ | ✔️ |
| `no-trailing-whitespace` | Disallow trailing whitespace | ✔️ | ✔️ |