unocss-preset-block
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

unocss-preset-block npm

UnoCSS Preset Block.

Features

  • 🔥 Disable non-standard unocss class names

Usage

pnpm i -D unocss-preset-block unocss
// uno.config.ts
import { defineConfig } from "unocss";
import { presetBlock } from "unocss-preset-block";

export default defineConfig({
  presets: [
    // ...
    presetBlock(),
  ],
});

Rules

Disable px/rem unit

<!-- bad -->
<div class="m-1rem">...</div>
<!-- good -->
<div class="m-4">...</div>

Disable magic-number

<!-- bad -->
<div class="text-3">...</div>
<!-- good -->
<div class="text-xs">...</div>

Disable consecutive dashes

<!-- bad -->
<div class="m--3">...</div>
<!-- good -->
<div class="-m-3">...</div>

Lint

Recommended to work with @unocss/eslint-plugin

// .eslintrc.js
module.exports = {
  plugins: [
    // ...
    "@unocss",
  ],
  rules: {
    // ...
    "@unocss/blocklist": ["error"]
  },
};

License

MIT License © 2023 Chizuki

Package Sidebar

Install

npm i unocss-preset-block

Weekly Downloads

107

Version

0.1.0

License

MIT

Unpacked Size

7.2 kB

Total Files

8

Last publish

Collaborators

  • chizukicn