refactor(design): drop rounded classes, swap bg-white and gray borders for tokens
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -366,7 +366,6 @@ Create `tests/scripts/modernist-codemod.test.ts`:
|
||||
|
||||
```ts
|
||||
import { describe, it, expect } from 'vitest'
|
||||
// @ts-expect-error plain .mjs script without types
|
||||
import { transformSource } from '../../scripts/modernist-codemod.mjs'
|
||||
|
||||
const t = (s: string): string => transformSource(s)
|
||||
@@ -450,8 +449,9 @@ function transformClassAttr(attr) {
|
||||
out = out.replace(/(?<![\w-])border-gray-(?:100|200|300)(?![\w-])/g, 'border-divider')
|
||||
out = out.replace(/(?<![\w-])divide-gray-(?:100|200|300)(?![\w-])/g, 'divide-divider')
|
||||
out = out.replace(/(?<![\w-])shadow-(?:xl|2xl)(?![\w-])/g, 'shadow-lg')
|
||||
out = out.replace(/(["'])([^"'`$]*)\1/g, (_, q, body) => q + body.trim().replace(/ {2,}/g, ' ') + q)
|
||||
out = out.replace(/^(className=\{`)\s+/, '$1').replace(/\s+(`\})$/, '$1')
|
||||
out = out.replace(/ {2,}/g, ' ')
|
||||
out = out.replace(/(["'`])\s+/g, '$1').replace(/\s+(["'`])/g, '$1')
|
||||
return out
|
||||
}
|
||||
|
||||
@@ -489,7 +489,7 @@ function main() {
|
||||
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) main()
|
||||
```
|
||||
|
||||
Note on the whitespace cleanup: the `(["'`])\s+` replacement trims spaces just inside quotes of every class attribute, which is safe because class lists never need leading or trailing space.
|
||||
Note on the whitespace cleanup: only string-literal bodies and the attribute's outer backtick delimiters are trimmed, so spaces around `?` and `:` inside `${...}` survive.
|
||||
|
||||
- [ ] **Step 4: Run the tests to verify they pass**
|
||||
|
||||
@@ -1592,7 +1592,6 @@ Create `tests/scripts/check-design-gates.test.ts`:
|
||||
|
||||
```ts
|
||||
import { describe, it, expect } from 'vitest'
|
||||
// @ts-expect-error plain .mjs script without types
|
||||
import { findViolations, ROUND_ALLOWED } from '../../scripts/check-design-gates.mjs'
|
||||
|
||||
const rules = (src: string, file = 'components/x.tsx'): string[] =>
|
||||
|
||||
Reference in New Issue
Block a user