516 mechanical replacements across 25 widget files: - spacing xs/sm/md/lg/xl to numeric 1/2/3/4/6 - text-heading-3 to text-lg font-semibold - bg-danger to bg-destructive - border border dedup Fix .eslintrc.tokens.js to use typescript-eslint parser (was importing uninstalled @typescript-eslint/parser). lint:tokens now passes.
45 lines
1.3 KiB
JavaScript
45 lines
1.3 KiB
JavaScript
/**
|
||
* ESLint Design Tokens 配置(独立运行:eslint -c .eslintrc.tokens.js src)
|
||
*
|
||
* 与 eslint.config.js 中的 design-tokens 规则等价,保留以对齐 teacher-portal 习惯。
|
||
* 使用 typescript-eslint 包的 parser(与 eslint.config.js 一致)。
|
||
* 关联:project_rules §3.10
|
||
*/
|
||
import tseslint from "typescript-eslint";
|
||
|
||
/** @type {import('eslint').Linter.Config[]} */
|
||
export default tseslint.config(
|
||
{
|
||
files: ["**/*.{ts,tsx,js,jsx}"],
|
||
languageOptions: {
|
||
parser: tseslint.parser,
|
||
ecmaVersion: 2024,
|
||
sourceType: "module",
|
||
parserOptions: {
|
||
ecmaFeatures: { jsx: true },
|
||
},
|
||
},
|
||
rules: {
|
||
"no-restricted-syntax": [
|
||
"error",
|
||
{
|
||
selector: "Literal[value=/^#[0-9a-fA-F]{3,8}$/]",
|
||
message:
|
||
"禁止硬编码颜色 #hex,使用 var(--*) 或 Tailwind bg-* 类(project_rules §3.10)",
|
||
},
|
||
{
|
||
selector: "Literal[value=/^(Inter|Fraunces|JetBrains Mono)$/]",
|
||
message:
|
||
"禁止硬编码字体名字面量,使用 var(--font-family-sans/serif/mono)(project_rules §3.10)",
|
||
},
|
||
],
|
||
},
|
||
},
|
||
{
|
||
files: ["**/primitive.css", "**/manifest.ts"],
|
||
rules: {
|
||
"no-restricted-syntax": "off",
|
||
},
|
||
},
|
||
);
|