Repository navigation
feat(enforce-consistent-line-wrapping): wrapStrings: "all" turns JS strings into templates (#216) - #232
Merged
Conversation
…trings into templates (#216) `wrapStrings: "jsx"` wraps a JSX attribute's own string in place, and every JS string kept reporting without a fix: it can't hold a raw newline. People moving from eslint-plugin-better-tailwindcss asked for its behaviour there (#216): when a JS string has to wrap, it becomes a template literal. - `"all"` does that, with a template's block layout, wherever the string's place takes any expression: a call argument (`cn("…")`), `className={"…"}`, an array element, an object value (`cva`, `tv`), a ternary branch, a `&&`/`||` operand, a variable's value. A JSX attribute's own string is still wrapped in place. - Never an object key or a `+` operand, and never a string a template would read differently: its source between the quotes must equal its value (no escape sequence) and hold no backtick or `${`. Those keep reporting. - The fix replaces the whole literal, quotes included, so `meta.fixable` is now 'code'. A CRLF file gets CRLF breaks. - Opt-in, because the string's value gains the newlines and the indentation: whitespace in a class list, not where the string is used as something else. `"jsx"` and the default `"never"` are unchanged. Tests: every place that converts and the ones that don't, the base indent, CRLF, both width fixers; dropping the escape check, the backtick or `${` exclusion, or the object-key or `+` exclusion each fails one. The #14 cycle (no-unnecessary-whitespace stays silent on the converted block), and an oxfmt e2e: a helper's template block survives only with preserveWhitespace, like a JSX string's. Docs: the rule page (EN/ES) with a ✗ example the docs test runs through oxlint, /interop (EN/ES), the better-tailwindcss migration row, CLAUDE.md, CHANGELOG. Bench corpus and synthetic identical. Claude-Session: https://claude.ai/code/session_019vTh6S5A41M1HLkmk3FaM1
sergioazoc
added a commit
that referenced
this pull request
Oct 10, 2026
- packages/oxlint-tailwindcss/package.json and the Claude Code plugin's plugin.json at 1.16.0. - CHANGELOG: Unreleased → 1.16.0 — Features (#216, #232: wrapStrings "all") and Documentation (#233: the eslint-plugin-tailwindcss migration guide). Nothing changes with the same config. - bench/results/latest.json regenerated after the bump (only the version and timings move), /benchmark and /comparison regenerated from it. Claude-Session: https://claude.ai/code/session_019vTh6S5A41M1HLkmk3FaM1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #216 (the request).
Summary
wrapStrings: "jsx"wraps a JSX attribute's own string in place. Every JS string kept reporting without a fix, because it can't hold a raw newline. People moving from eslint-plugin-better-tailwindcss want what it does there: when a JS string has to wrap, it becomes a template literal.cn("…")),className={"…"}, an array element, an object value (cva,tv), a ternary branch, a&&/||operand, or a variable's value. These are the same places better-tailwindcss converts (checked in its 4.9.0 source). A JSX attribute's own string is still wrapped in place.+operand. Also never a string a template would read differently: its source between the quotes must equal its value (no escape sequence) and contain no backtick or${. Those keep reporting. better-tailwindcss only escapes the backtick, so a${in a string becomes an interpolation there.meta.fixableis now'code'. A CRLF file gets CRLF breaks."jsx"and the default"never"are unchanged.Test plan
classesPerLineand both width fixers. Dropping the escape check, the backtick or${exclusion, or the object-key or+exclusion each fails a test.no-unnecessary-whitespaceand the rule itself stay silent on the converted block.sortTailwindcssonly withpreserveWhitespace: true, like a JSX string's. Checked by hand first, then pinned./interop(EN/ES), the better-tailwindcss migration row, CLAUDE.md and CHANGELOG.lint:types,format:check, typecheck, build andpnpm test(3811 + 312).pnpm -C packages/docs build:check-distok. Bench corpus and synthetic identical to the baselines.🤖 Generated with Claude Code
https://claude.ai/code/session_019vTh6S5A41M1HLkmk3FaM1