Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"ecmaVersion": 2021,
"sourceType": "module"
},
"plugins": ["react", "@typescript-eslint", "jsx-a11y"],
"plugins": ["react", "@typescript-eslint", "jsx-a11y", "tailwindcss"],
"rules": {
"import/extensions": [
"warn",
Expand All @@ -42,7 +42,8 @@
"import/no-unresolved": [2, { "commonjs": true, "amd": true }],
"import/no-extraneous-dependencies": 2,
"import/order": "error",
"react/react-in-jsx-scope": ["off"]
"react/react-in-jsx-scope": ["off"],
"tailwindcss/no-arbitrary-value": "error"
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tailwindcss/no-arbitrary-value is broader than "design token enforcement" here: it also rejects valid Tailwind arbitrary variants/modifiers, not just raw values. I reproduced this locally with <div className="data-[state=open]:pb-8" />, which fails with Arbitrary value detected in data-[state=open]:pb-8. Because this repo already depends on Headless UI, that is a realistic false-positive path for standard Tailwind state selectors, and it will force inline disables as soon as we adopt them.

},
"settings": {
"import/resolver": {
Expand All @@ -52,6 +53,9 @@
},
"react": {
"version": "detect"
},
"tailwindcss": {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn’t fully enforce the rule across the current codebase because the plugin’s default callees list does not include our local classNames() helper. I counted 32 classNames( call sites in app/, and I reproduced that className={classNames(bg-[#fff], p-4)} passes lint while the same sample with clsx(...) fails. Please add settings.tailwindcss.callees with classNames (or migrate those call sites), otherwise arbitrary values still slip through many existing composition paths.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plugin only inspects call expressions whose callee is listed in settings.tailwindcss.callees, and its default list is just classnames, clsx, and ctl. This repo builds many class strings with classNames(...) (for example app/components/button-link.tsx and app/components/page-link.tsx), so arbitrary values inside those calls currently bypass the new rule. I verified that className={classNames("bg-[#fff]", "p-4")} passes lint while the same class in JSX or clsx(...) fails. Please add classNames here or the enforcement will miss a substantial part of the codebase.

"config": "tailwind.config.js"
}
},
"overrides": [
Expand Down
78 changes: 52 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"eslint-plugin-jsx-a11y": "6.5.1",
"eslint-plugin-playwright": "2.4.0",
"eslint-plugin-react": "7.27.1",
"eslint-plugin-tailwindcss": "^3.5.2",
"eslint-plugin-yml": "0.12.0",
"husky": "7.0.4",
"is-ci-cli": "2.2.0",
Expand Down
Loading