load-oxfmt-config 0.4.0 → 0.4.1

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
@@ -284,12 +284,13 @@ The loader reads the nearest `.editorconfig` file and maps the subset of fields
284
284
 
285
285
  - `end_of_line` → `endOfLine`
286
286
  - `indent_style` → `useTabs`
287
- - `indent_size` / `tab_width` `tabWidth`
287
+ - `indent_size` `tabWidth` when `indent_style = space`
288
+ - `tab_width` → `tabWidth`
288
289
  - `max_line_length` → `printWidth`
289
290
  - `insert_final_newline` → `insertFinalNewline`
290
291
  - `quote_type` → `singleQuote`
291
292
 
292
- Glob sections such as `[*.ts]` are converted into returned `overrides` entries.
293
+ Only `[*]` is treated as a global section to match oxfmt. Other sections such as `[**]` and `[*.ts]` are converted into returned `overrides` entries.
293
294
 
294
295
  ## Precedence
295
296
 
package/dist/index.mjs CHANGED
@@ -21,7 +21,7 @@ const EDITORCONFIG_FILE = ".editorconfig";
21
21
  /**
22
22
  * Sections that apply globally and can be merged into root-level oxfmt options.
23
23
  */
24
- const EDITORCONFIG_GLOBAL_SECTION_NAMES = ["*", "**"];
24
+ const EDITORCONFIG_GLOBAL_SECTION_NAMES = ["*"];
25
25
  //#endregion
26
26
  //#region src/editorconfig.ts
27
27
  /**
@@ -139,12 +139,13 @@ function parseEditorconfigQuoteType(value) {
139
139
  * Resolves the effective tab width from an EditorConfig section.
140
140
  *
141
141
  * @param section - The parsed EditorConfig section body.
142
+ * @param useTabs - The resolved indent style from the same section, when available.
142
143
  * @returns The resolved tab width, or undefined when no numeric value is available.
143
144
  */
144
- function parseEditorconfigTabWidth(section) {
145
+ function parseEditorconfigTabWidth(section, useTabs) {
145
146
  const indentSize = section["indent_size"];
146
147
  const tabWidth = section["tab_width"];
147
- if (indentSize && indentSize !== "unset" && indentSize !== "tab") {
148
+ if (useTabs === false && indentSize && indentSize !== "unset" && indentSize !== "tab") {
148
149
  const parsedIndentSize = Number(indentSize);
149
150
  if (Number.isFinite(parsedIndentSize)) return parsedIndentSize;
150
151
  }
@@ -167,7 +168,7 @@ function mapEditorconfigSectionToOptions(section) {
167
168
  else if (section["indent_style"] === "space") options.useTabs = false;
168
169
  const singleQuote = parseEditorconfigQuoteType(section["quote_type"]);
169
170
  if (isBoolean(singleQuote)) options.singleQuote = singleQuote;
170
- const tabWidth = parseEditorconfigTabWidth(section);
171
+ const tabWidth = parseEditorconfigTabWidth(section, options.useTabs);
171
172
  if (isNumber(tabWidth)) options.tabWidth = tabWidth;
172
173
  if (section["max_line_length"] && section["max_line_length"] !== "unset") {
173
174
  const parsedPrintWidth = Number(section["max_line_length"]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "load-oxfmt-config",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Load oxfmt config files and merge supported .editorconfig options.",
5
5
  "keywords": [
6
6
  "editorconfig",
@@ -39,7 +39,7 @@
39
39
  "access": "public"
40
40
  },
41
41
  "dependencies": {
42
- "@ntnyq/utils": "^0.12.0",
42
+ "@ntnyq/utils": "^0.13.2",
43
43
  "editorconfig": "^3.0.2",
44
44
  "jiti": "^2.6.1",
45
45
  "jsonc-parser": "^3.3.1"
@@ -47,15 +47,15 @@
47
47
  "devDependencies": {
48
48
  "@ntnyq/tsconfig": "^3.1.0",
49
49
  "@types/node": "^25.6.0",
50
- "@typescript/native-preview": "^7.0.0-dev.20260413.1",
50
+ "@typescript/native-preview": "^7.0.0-dev.20260426.1",
51
51
  "bumpp": "^11.0.1",
52
52
  "husky": "^9.1.7",
53
53
  "nano-staged": "^1.0.2",
54
54
  "npm-run-all2": "^8.0.4",
55
- "oxfmt": "^0.45.0",
56
- "oxlint": "^1.60.0",
57
- "tsdown": "^0.21.8",
58
- "vitest": "^4.1.4"
55
+ "oxfmt": "^0.46.0",
56
+ "oxlint": "^1.61.0",
57
+ "tsdown": "^0.21.10",
58
+ "vitest": "^4.1.5"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "oxfmt": ">=0.41.0"