eslint-plugin-oxfmt 0.0.4 → 0.0.5

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/README.md CHANGED
@@ -150,11 +150,49 @@ All options are optional and default to sensible values.
150
150
 
151
151
  ### Advanced Options
152
152
 
153
- | Option | Type | Default | Description |
154
- | ----------------------------- | ----------------- | -------- | ----------------------------------------- |
155
- | `embeddedLanguageFormatting` | `'auto' \| 'off'` | `'auto'` | Control formatting of quoted code |
156
- | `experimentalSortImports` | `object` | - | Experimental import sorting configuration |
157
- | `experimentalSortPackageJson` | `boolean` | - | Experimental package.json sorting |
153
+ | Option | Type | Default | Description |
154
+ | ----------------------------- | ----------------- | -------- | ------------------------------------------------------------------- |
155
+ | `embeddedLanguageFormatting` | `'auto' \| 'off'` | `'auto'` | Control formatting of quoted code |
156
+ | `experimentalSortImports` | `object` | - | Experimental import sorting configuration |
157
+ | `experimentalSortPackageJson` | `boolean` | - | Experimental package.json sorting |
158
+ | `experimentalTailwindcss` | `object` | - | Experimental Tailwind CSS class sorting (enable with `{}` for defaults) |
159
+
160
+ #### Tailwind CSS class sorting
161
+
162
+ Enable experimental Tailwind CSS class sorting powered by `prettier-plugin-tailwindcss` (pass an empty object to turn it on):
163
+
164
+ ```js
165
+ // eslint.config.mjs
166
+ import pluginOxfmt from 'eslint-plugin-oxfmt'
167
+
168
+ export default [
169
+ {
170
+ ...pluginOxfmt.configs.recommended,
171
+ files: ['**/*.{js,ts,jsx,tsx}'],
172
+ rules: {
173
+ 'oxfmt/oxfmt': [
174
+ 'error',
175
+ {
176
+ experimentalTailwindcss: {},
177
+ },
178
+ ],
179
+ },
180
+ },
181
+ ]
182
+ ```
183
+
184
+ You can pass the Tailwind plugin options to control which attributes/functions are sorted or keep duplicates:
185
+
186
+ ```js
187
+ {
188
+ experimentalTailwindcss: {
189
+ attributes: ['class', 'className', ':class'],
190
+ functions: ['clsx', 'cn'],
191
+ preserveDuplicates: false,
192
+ preserveWhitespace: false,
193
+ },
194
+ }
195
+ ```
158
196
 
159
197
  ## Rules
160
198
 
package/dist/index.mjs CHANGED
@@ -67,7 +67,7 @@ const configs = { recommended };
67
67
  //#endregion
68
68
  //#region package.json
69
69
  var name = "eslint-plugin-oxfmt";
70
- var version = "0.0.4";
70
+ var version = "0.0.5";
71
71
 
72
72
  //#endregion
73
73
  //#region src/meta.ts
@@ -182,7 +182,7 @@ const oxfmt = {
182
182
  type: "boolean"
183
183
  },
184
184
  embeddedLanguageFormatting: {
185
- description: `Control whether formats quoted code embedded in the file. (Default: "auto")`,
185
+ description: `Control whether to format embedded parts in the file.\ne.g. JS-in-Vue, CSS-in-JS, etc. (Default: "auto")`,
186
186
  enum: ["auto", "off"],
187
187
  type: "string"
188
188
  },
@@ -244,6 +244,39 @@ const oxfmt = {
244
244
  description: `Experimental: Sort package.json keys. (Default: true)`,
245
245
  type: "boolean"
246
246
  },
247
+ experimentalTailwindcss: {
248
+ additionalProperties: false,
249
+ description: `Experimental: Enable Tailwind CSS class sorting in JSX class/className attributes.\nWhen enabled, class strings will be collected and passed to a callback for sorting.\nPass an object with options from "prettier-plugin-tailwindcss".\n(Default: disabled)`,
250
+ type: "object",
251
+ properties: {
252
+ attributes: {
253
+ description: `List of attributes that contain Tailwind CSS classes.\n\nExample: ["myClassProp", ":class"]\n\nDefault: ["class", "className"]`,
254
+ type: "array",
255
+ items: { type: "string" }
256
+ },
257
+ config: {
258
+ description: `Path to your Tailwind CSS configuration file (v3).\n\nNote: Paths are resolved relative to the Oxfmt configuration file.\n\nDefault: "./tailwind.config.js"`,
259
+ type: "string"
260
+ },
261
+ functions: {
262
+ description: `List of custom function names that contain Tailwind CSS classes.\n\nExample: ["clsx", "cn", "cva", "tw"]\n\nDefault: []`,
263
+ type: "array",
264
+ items: { type: "string" }
265
+ },
266
+ preserveDuplicates: {
267
+ description: `Preserve duplicate classes.\n\nDefault: false`,
268
+ type: "boolean"
269
+ },
270
+ preserveWhitespace: {
271
+ description: `Preserve whitespace around classes.\n\nDefault: false`,
272
+ type: "boolean"
273
+ },
274
+ stylesheet: {
275
+ description: `Path to your Tailwind CSS stylesheet (v4).\n\nNote: Paths are resolved relative to the Oxfmt configuration file.\n\nExample: "./src/app.css"`,
276
+ type: "string"
277
+ }
278
+ }
279
+ },
247
280
  ignorePatterns: {
248
281
  description: `Ignore files matching these glob patterns. Current working directory is used as the root.`,
249
282
  type: "array",
@@ -45,6 +45,21 @@ export type OxfmtOxfmt = []|[{
45
45
 
46
46
  experimentalSortPackageJson?: boolean
47
47
 
48
+ experimentalTailwindcss?: {
49
+
50
+ attributes?: string[]
51
+
52
+ config?: string
53
+
54
+ functions?: string[]
55
+
56
+ preserveDuplicates?: boolean
57
+
58
+ preserveWhitespace?: boolean
59
+
60
+ stylesheet?: string
61
+ }
62
+
48
63
  ignorePatterns?: string[]
49
64
 
50
65
  insertFinalNewline?: boolean
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "eslint-plugin-oxfmt",
3
3
  "type": "module",
4
- "version": "0.0.4",
4
+ "version": "0.0.5",
5
5
  "description": "An ESLint plugin for formatting code with oxfmt.",
6
6
  "keywords": [
7
7
  "eslint",
@@ -47,15 +47,15 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "generate-differences": "^0.1.1",
50
- "load-oxfmt-config": "^0.0.3",
51
- "oxfmt": "^0.21.0",
50
+ "load-oxfmt-config": "^0.0.4",
51
+ "oxfmt": "^0.22.0",
52
52
  "synckit": "^0.11.11"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@ntnyq/eslint-config": "^5.9.0",
56
56
  "@ntnyq/prettier-config": "^3.0.1",
57
57
  "@types/node": "^25.0.3",
58
- "@typescript/native-preview": "7.0.0-dev.20251204.1",
58
+ "@typescript/native-preview": "^7.0.0-dev.20260105.1",
59
59
  "bumpp": "^10.3.2",
60
60
  "eslint": "^9.39.2",
61
61
  "eslint-parser-plain": "^0.1.1",
@@ -85,6 +85,6 @@
85
85
  "release:version": "bumpp",
86
86
  "test": "vitest",
87
87
  "typecheck": "tsgo --noEmit",
88
- "update:rule-options": "tsx scripts/udpateRuleOptions.ts"
88
+ "update:rule-options": "tsx scripts/updateRuleOptions.ts"
89
89
  }
90
90
  }