@maz-ui/mcp 5.0.0-beta.4 → 5.0.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mcp.mjs CHANGED
@@ -7,7 +7,7 @@ import { existsSync, readFileSync, readdirSync } from 'node:fs';
7
7
  import { resolve, join, dirname } from 'node:path';
8
8
  import { fileURLToPath } from 'node:url';
9
9
 
10
- const version = "5.0.0-beta.3";
10
+ const version = "5.0.0-beta.5";
11
11
 
12
12
  class MetadataExtractor {
13
13
  extract(name, type, content, manualTags = []) {
@@ -114,6 +114,8 @@ defineConfig({
114
114
  detectComponentClasses: true,
115
115
  // Monorepo: directory used to resolve `tailwindcss` and the config file.
116
116
  cwd: 'apps/web',
117
+ // Custom `maz/tailwind-no-arbitrary-px` rule — see "Custom rules" below.
118
+ noArbitraryPx: true,
117
119
  },
118
120
  })
119
121
  ```
@@ -135,12 +137,98 @@ defineConfig({
135
137
 
136
138
  The plugin recognizes the most common class-name utilities out of the box (`clsx`, `cn`, `tw-merge`, `cva`, `tv`, …); see the [plugin docs](https://github.com/schoero/eslint-plugin-better-tailwindcss) for the full list and how to register your own.
137
139
 
140
+ ## Custom rules
141
+
142
+ `@maz-ui/eslint-config` ships its own ESLint plugin under the **`maz/*`** namespace. Rules are grouped by category — `maz/tailwind-*` today, with room for `maz/js-*` and others as they get added.
143
+
144
+ ### `maz/tailwind-no-arbitrary-px`
145
+
146
+ Forbids `px` units inside Tailwind arbitrary value classes (`w-[16px]`, `m-[-16px]`, `[gap:24px]`, …) and **autofixes** them to `rem` (or `em`) using your project's root font-size. Whitespace inside brackets (e.g. `[up to 100px]`) is left alone, so plain prose is never rewritten by accident.
147
+
148
+ ::: info Registered only when `tailwindcss` is enabled
149
+ The `maz` plugin and the `maz/tailwind-*` rules are only added to the flat-config when `tailwindcss` is set to anything other than `false`. With `tailwindcss: false` *(default)*, neither the plugin nor the rule appear in the resolved config — keeping the preset zero-cost for non-Tailwind projects. To use the rule without opting into the full Tailwind preset, register `mazPlugin` manually (see [Use the plugin directly](#use-the-plugin-directly)).
150
+ :::
151
+
152
+ When `tailwindcss` is on, the rule is enabled with defaults. You can tune it two ways:
153
+
154
+ **Standard ESLint override** *(idiomatic, max control)*
155
+
156
+ ```ts
157
+ defineConfig({
158
+ tailwindcss: 'recommended',
159
+ rules: {
160
+ 'maz/tailwind-no-arbitrary-px': ['error', { baseFontSize: 10, unit: 'em' }],
161
+ },
162
+ })
163
+ ```
164
+
165
+ User `rules` overrides are applied in a *trailing* flat-config block, so they win over the defaults wired in by `tailwindcssConfigs`.
166
+
167
+ **Ergonomic shortcut** *(set defaults via `tailwindcss.noArbitraryPx`)*
168
+
169
+ ```ts
170
+ defineConfig({
171
+ tailwindcss: {
172
+ preset: 'recommended',
173
+ noArbitraryPx: {
174
+ baseFontSize: 16, // default — divide px by this to get rem
175
+ unit: 'rem', // default — output unit ('rem' | 'em')
176
+ severity: 'error', // default — 'off' | 'warn' | 'error'
177
+ },
178
+ },
179
+ })
180
+ ```
181
+
182
+ | `noArbitraryPx` value | Behavior |
183
+ | ---------------------------------- | --------------------------------------------------- |
184
+ | `true` *(default)* | Enabled with defaults (`baseFontSize: 16`, `rem`). |
185
+ | `false` | Disabled. |
186
+ | `{ baseFontSize, unit, severity }` | Override any subset of the defaults. |
187
+
188
+ If both are set, the standard `rules` override wins (it's the last block applied).
189
+
190
+ What the autofix does (with `baseFontSize: 16`):
191
+
192
+ | Before | After |
193
+ | ----------------------- | ------------------------ |
194
+ | `w-[16px]` | `w-[1rem]` |
195
+ | `m-[-16px]` | `m-[-1rem]` |
196
+ | `tracking-[.5px]` | `tracking-[0.03125rem]` |
197
+ | `p-[16px_8px]` | `p-[1rem_0.5rem]` |
198
+ | `[gap:24px]` | `[gap:1.5rem]` |
199
+ | `w-[calc(100%-16px)]` | `w-[calc(100%-1rem)]` |
200
+ | `md:hover:w-[16px]` | `md:hover:w-[1rem]` |
201
+
202
+ The rule fires on:
203
+
204
+ - JSX `className` strings and template literals
205
+ - Vue SFC static `class="…"` attributes (via `vue-eslint-parser`)
206
+ - Vue dynamic `:class` bindings, including string literals inside arrays / objects
207
+ - Function-call arguments and tagged template literals (`clsx`, `cn`, `cva`, `tw`, …)
208
+
209
+ ### Use the plugin directly
210
+
211
+ If you don't want the full Tailwind preset (or just prefer wiring rules yourself), import `mazPlugin` and register it in your own flat-config block. This is also the way to use `maz/tailwind-*` rules **without** enabling `tailwindcss` in `defineConfig`:
212
+
213
+ ```ts
214
+ import { mazPlugin } from '@maz-ui/eslint-config'
215
+
216
+ export default [{
217
+ files: ['**/*.{ts,tsx,vue}'],
218
+ plugins: { maz: mazPlugin },
219
+ rules: {
220
+ 'maz/tailwind-no-arbitrary-px': ['error', { baseFontSize: 16, unit: 'rem' }],
221
+ },
222
+ }]
223
+ ```
224
+
138
225
  ## What it includes
139
226
 
140
227
  - **Antfu base** — TypeScript-aware rules, Stylistic formatting, modern import order.
141
228
  - **SonarJS** — code quality and complexity heuristics, with a relaxed set for `*.spec.ts` / `*.test.ts`.
142
229
  - **Vue rules** (when Vue/Nuxt is detected) — block-tag order, naming conventions, template a11y.
143
230
  - **Tailwind plugin** (opt-in) — class ordering, duplicate / deprecated / unknown / conflicting class detection — see [Tailwind support](#tailwind-support).
231
+ - **`maz/*` custom rules** — namespaced ESLint plugin shipped with the preset; see [Custom rules](#custom-rules).
144
232
  - **Markdown** — prose linting baseline.
145
233
  - **vueAccessibility** (opt-in) — `eslint-plugin-vuejs-accessibility` rules with the AudioWorklet globals fix.
146
234
 
@@ -151,6 +239,7 @@ The plugin recognizes the most common class-name utilities out of the box (`clsx
151
239
  ```ts
152
240
  import {
153
241
  baseRules,
242
+ mazPlugin,
154
243
  sonarjsRules,
155
244
  tailwindcssConfigs,
156
245
  vueRules,
@@ -158,14 +247,19 @@ import {
158
247
 
159
248
  export default [
160
249
  {
250
+ plugins: { maz: mazPlugin },
161
251
  rules: {
162
252
  ...baseRules(true), // production = true → no-console: 'error'
163
253
  ...sonarjsRules,
164
254
  ...vueRules,
255
+ 'maz/tailwind-no-arbitrary-px': 'error',
165
256
  },
166
257
  },
167
258
  // Drop in just the Tailwind block, with whatever preset and settings you want.
168
- ...tailwindcssConfigs('stylistic', { entryPoint: 'src/main.css' }),
259
+ ...tailwindcssConfigs('stylistic', {
260
+ entryPoint: 'src/main.css',
261
+ noArbitraryPx: { unit: 'em' },
262
+ }),
169
263
  ]
170
264
  ```
171
265
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@maz-ui/mcp",
3
3
  "type": "module",
4
- "version": "5.0.0-beta.4",
4
+ "version": "5.0.0-beta.6",
5
5
  "description": "Maz-UI ModelContextProtocol Client",
6
6
  "author": "Louis Mazel <me@loicmazuel.com>",
7
7
  "license": "MIT",
@@ -42,8 +42,8 @@
42
42
  ],
43
43
  "dependencies": {
44
44
  "@modelcontextprotocol/sdk": "^1.29.0",
45
- "@maz-ui/node": "5.0.0-beta.4",
46
- "@maz-ui/utils": "5.0.0-beta.4"
45
+ "@maz-ui/node": "5.0.0-beta.5",
46
+ "@maz-ui/utils": "5.0.0-beta.6"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@modelcontextprotocol/inspector": "^0.21.2",
@@ -52,7 +52,7 @@
52
52
  "ts-node-maintained": "^10.9.5",
53
53
  "tsx": "^4.21.0",
54
54
  "unbuild": "^3.6.1",
55
- "@maz-ui/eslint-config": "5.0.0-beta.4"
55
+ "@maz-ui/eslint-config": "5.0.0-beta.6"
56
56
  },
57
57
  "lint-staged": {
58
58
  "*.{js,ts,mjs,mts,cjs,md,yml,json}": "cross-env NODE_ENV=production eslint --fix"