eslint-plugin-oxfmt 0.0.3 → 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 +43 -5
- package/dist/index.mjs +37 -4
- package/dts/rule-options.d.ts +16 -1
- package/package.json +7 -7
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.
|
|
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
|
|
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
|
},
|
|
@@ -203,10 +203,10 @@ const oxfmt = {
|
|
|
203
203
|
groups: {
|
|
204
204
|
description: `Custom groups configuration for organizing imports.\nEach array element represents a group, and multiple group names in the same array are treated as one.\nAccepts both string and string[] as group elements.`,
|
|
205
205
|
type: "array",
|
|
206
|
-
items: {
|
|
206
|
+
items: { anyOf: [{ type: "string" }, {
|
|
207
207
|
type: "array",
|
|
208
208
|
items: { type: "string" }
|
|
209
|
-
}
|
|
209
|
+
}] }
|
|
210
210
|
},
|
|
211
211
|
ignoreCase: {
|
|
212
212
|
description: `Ignore case when sorting. (Default: true)`,
|
|
@@ -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",
|
package/dts/rule-options.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export type OxfmtOxfmt = []|[{
|
|
|
26
26
|
|
|
27
27
|
experimentalSortImports?: {
|
|
28
28
|
|
|
29
|
-
groups?: string[][]
|
|
29
|
+
groups?: (string | string[])[]
|
|
30
30
|
|
|
31
31
|
ignoreCase?: boolean
|
|
32
32
|
|
|
@@ -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
|
+
"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.
|
|
51
|
-
"oxfmt": "^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
|
-
"@ntnyq/eslint-config": "^5.
|
|
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.
|
|
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",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"prettier": "^3.7.4",
|
|
68
68
|
"show-invisibles": "^0.0.2",
|
|
69
69
|
"tinyglobby": "^0.2.15",
|
|
70
|
-
"tsdown": "^0.
|
|
70
|
+
"tsdown": "^0.19.0-beta.2",
|
|
71
71
|
"tsx": "^4.21.0",
|
|
72
72
|
"typescript": "^5.9.3",
|
|
73
73
|
"vitest": "^4.0.16"
|
|
@@ -85,6 +85,6 @@
|
|
|
85
85
|
"release:version": "bumpp",
|
|
86
86
|
"test": "vitest",
|
|
87
87
|
"typecheck": "tsgo --noEmit",
|
|
88
|
-
"update:rule-options": "tsx scripts/
|
|
88
|
+
"update:rule-options": "tsx scripts/updateRuleOptions.ts"
|
|
89
89
|
}
|
|
90
90
|
}
|