load-oxfmt-config 0.6.0 → 0.7.0
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 +11 -1
- package/dist/index.d.mts +6 -0
- package/dist/index.mjs +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -389,6 +389,14 @@ Whether to use in-memory cache.
|
|
|
389
389
|
|
|
390
390
|
Whether to include ignore patterns defined in the resolved config file.
|
|
391
391
|
|
|
392
|
+
#### `loadConfigForIgnorePatterns`
|
|
393
|
+
|
|
394
|
+
- **Type:** `boolean`
|
|
395
|
+
- **Default:** `true`
|
|
396
|
+
|
|
397
|
+
Whether to load the resolved config file during ignore checks.
|
|
398
|
+
When `false`, `isOxfmtIgnored()` only applies global ignore and skips config loading.
|
|
399
|
+
|
|
392
400
|
**Returns:** `Promise<IsOxfmtIgnoredResult>`
|
|
393
401
|
|
|
394
402
|
- `ignored` - Whether the file is ignored
|
|
@@ -478,7 +486,8 @@ Only `[*]` is treated as a global section to match oxfmt. Other sections such as
|
|
|
478
486
|
1. Global ignore
|
|
479
487
|
2. Ignore patterns from the resolved oxfmt config (`ignorePatterns`)
|
|
480
488
|
|
|
481
|
-
Set `includeConfigIgnorePatterns: false` to
|
|
489
|
+
Set `includeConfigIgnorePatterns: false` to skip config `ignorePatterns` matching.
|
|
490
|
+
Set `loadConfigForIgnorePatterns: false` to skip config loading entirely and keep only global ignore behavior.
|
|
482
491
|
|
|
483
492
|
Global ignore includes:
|
|
484
493
|
|
|
@@ -495,6 +504,7 @@ Notes:
|
|
|
495
504
|
- The default lockfile list mirrors oxfmt documentation intent (`package-lock.json`, `pnpm-lock.yaml`, etc.) and common ecosystem lockfiles. It is not guaranteed to be a complete internal oxfmt list.
|
|
496
505
|
- `ignorePatterns` are always interpreted relative to the resolved oxfmt config directory.
|
|
497
506
|
- `includeConfigIgnorePatterns` defaults to `true` to preserve current behavior.
|
|
507
|
+
- `loadConfigForIgnorePatterns` defaults to `true` to preserve current behavior.
|
|
498
508
|
- Nested config behavior follows oxfmt semantics:
|
|
499
509
|
- default: nearest config from target file directory upward
|
|
500
510
|
- `disableNestedConfig: true`: resolve from `cwd` only
|
package/dist/index.d.mts
CHANGED
|
@@ -137,6 +137,12 @@ interface IsOxfmtIgnoredOptions {
|
|
|
137
137
|
* @default true
|
|
138
138
|
*/
|
|
139
139
|
includeConfigIgnorePatterns?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Whether to load resolved oxfmt config when evaluating config ignore patterns.
|
|
142
|
+
* When false, only global ignore is applied and config loading is skipped.
|
|
143
|
+
* @default true
|
|
144
|
+
*/
|
|
145
|
+
loadConfigForIgnorePatterns?: boolean;
|
|
140
146
|
}
|
|
141
147
|
/**
|
|
142
148
|
* Ignore resolution result.
|
package/dist/index.mjs
CHANGED
|
@@ -555,6 +555,7 @@ function matchConfigIgnorePatterns(filepath, configDir, patterns) {
|
|
|
555
555
|
async function isOxfmtIgnored(options) {
|
|
556
556
|
const useCache = options.useCache !== false;
|
|
557
557
|
const includeConfigIgnorePatterns = options.includeConfigIgnorePatterns !== false;
|
|
558
|
+
const loadConfigForIgnorePatterns = options.loadConfigForIgnorePatterns !== false;
|
|
558
559
|
const cwd = resolve(options.cwd ?? process.cwd());
|
|
559
560
|
const filepath = isAbsolute(options.filepath) ? resolve(options.filepath) : resolve(cwd, options.filepath);
|
|
560
561
|
if (isDefaultIgnoredDir(filepath, options.withNodeModules ? { withNodeModules: true } : {})) return {
|
|
@@ -575,6 +576,7 @@ async function isOxfmtIgnored(options) {
|
|
|
575
576
|
ignored: true,
|
|
576
577
|
reason: ignoreFile === ".gitignore" ? "gitignore" : "prettierignore"
|
|
577
578
|
};
|
|
579
|
+
if (!loadConfigForIgnorePatterns) return { ignored: false };
|
|
578
580
|
const configResult = await loadOxfmtConfigResult({
|
|
579
581
|
cwd: options.configPath || options.disableNestedConfig ? cwd : dirname(filepath),
|
|
580
582
|
...options.configPath ? { configPath: options.configPath } : {},
|