@isentinel/eslint-config 6.0.0-beta.44 → 6.0.0-beta.46
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 +37 -7
- package/dist/cli.mjs +3 -3
- package/dist/index.d.mts +9 -3
- package/dist/index.mjs +120 -12
- package/dist/lint-cli.mjs +444 -208
- package/dist/lint-ignored.mjs +8 -6
- package/dist/oxlint.d.mts +5 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -255,8 +255,8 @@ Other behaviours:
|
|
|
255
255
|
(see `FAST_FILES_PER_WORKER`) than the type-aware pass.
|
|
256
256
|
- Keeps a separate ESLint cache per pass so they never invalidate one another:
|
|
257
257
|
`.eslintcache-fast-<key>` (fast pass), `.eslintcache-typeaware-<key>`
|
|
258
|
-
(type-aware pass), and `.eslintcache-<key>` (the full
|
|
259
|
-
|
|
258
|
+
(type-aware pass), and `.eslintcache-<key>` (the full config, used by CI,
|
|
259
|
+
`--type-aware=full` and the fix child below). A change to an
|
|
260
260
|
ESLint/oxlint/Prettier/tsconfig file or a lockfile clears each cache that is
|
|
261
261
|
actually older than that change; a change to the root `package.json`
|
|
262
262
|
resolution surface (`exports`, `imports`, `main`, `module`, `types`,
|
|
@@ -281,16 +281,46 @@ Other behaviours:
|
|
|
281
281
|
value naming that branch. It is folded into the key, giving those configs
|
|
282
282
|
separate caches too.
|
|
283
283
|
|
|
284
|
-
-
|
|
285
|
-
|
|
284
|
+
- Treats `--fix` as a check followed by a fix, in three steps. `oxlint --fix`
|
|
285
|
+
goes first and alone, since it rewrites the files the ESLint children are
|
|
286
|
+
about to read. The run's ESLint passes then run as ordinary **checks** —
|
|
287
|
+
concurrent, own caches, no writes. By default those are the fast and
|
|
288
|
+
type-aware passes — the single full pass in CI; an explicit `--type-aware`
|
|
289
|
+
checks whichever passes that mode selects instead (`full` the single full
|
|
290
|
+
pass, `only` the type-aware pass alone, `off` the fast pass alone). Finally
|
|
291
|
+
**one** ESLint child applies fixes to **only the files those checks had
|
|
292
|
+
messages about**, using the full config (a superset of every pass, so it can
|
|
293
|
+
fix anything any of them found).
|
|
294
|
+
|
|
295
|
+
When the checks report nothing, which is the common case, that last child
|
|
296
|
+
never spawns and `--fix` costs what a check run costs. Being the run's only
|
|
297
|
+
ESLint writer, it also cannot race anything.
|
|
298
|
+
|
|
299
|
+
The file list comes from the check passes' own caches: ESLint stores each
|
|
300
|
+
file's result beside its cache entry and replays it on a cache hit, so a warm
|
|
301
|
+
cache is that pass's whole-tree verdict — including for a pass that
|
|
302
|
+
auto-skipped, whose verdict stands precisely because nothing it cares about
|
|
303
|
+
changed. `--no-cache` leaves no verdict to read, so the fix child falls back
|
|
304
|
+
to linting everything it was given. A target outside the working directory is
|
|
305
|
+
invisible to the listing the verdict is read against, so it is handed to the
|
|
306
|
+
fix child as it stands, alongside the reported files; that child runs without
|
|
307
|
+
the cache, since a stale entry for a file no verdict covers would let ESLint
|
|
308
|
+
skip it.
|
|
309
|
+
|
|
286
310
|
- Lets every child run to completion and returns non-zero if any failed — an
|
|
287
311
|
ordinary lint error in one tool no longer kills the others mid-run.
|
|
288
312
|
|
|
289
313
|
> **Unused eslint-disable directives.** The default two-pass mode does **not**
|
|
290
314
|
> report unused `eslint-disable` directives: a directive naming a rule that
|
|
291
315
|
> lives in the _other_ pass would look unused to the pass that runs it and
|
|
292
|
-
> produce a false positive.
|
|
293
|
-
>
|
|
316
|
+
> produce a false positive. CI and `--type-aware=full` runs use the single full
|
|
317
|
+
> config and still report them.
|
|
318
|
+
>
|
|
319
|
+
> A local `--fix` inherits this from its checks. The fix child runs the full
|
|
320
|
+
> config and would report an unused directive, but it only ever sees the files
|
|
321
|
+
> the checks reported, and a file whose _only_ problem is an unused directive is
|
|
322
|
+
> not one of them — so those directives survive a local fix run. In CI the check
|
|
323
|
+
> is the full config, so they are reported and removed as before.
|
|
294
324
|
|
|
295
325
|
### Hybrid detection
|
|
296
326
|
|
|
@@ -317,7 +347,7 @@ Any trailing positional arguments are treated as paths to lint (default `.`).
|
|
|
317
347
|
| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
318
348
|
| `--eslint` | Run only ESLint. |
|
|
319
349
|
| `--oxlint` | Run only oxlint. |
|
|
320
|
-
| `--fix` |
|
|
350
|
+
| `--fix` | Check as usual, then fix only the files the checks reported (one child). |
|
|
321
351
|
| `--agents`, `--no-agents` | Force agent-friendly output from both linters on or off (default: on in an agent session). |
|
|
322
352
|
| `--type-aware=off\|only\|full` | Force a single ESLint pass: `off` fast-only, `only` type-aware-only, `full` the whole config in one pass. Cannot mix with `--fix`. |
|
|
323
353
|
| `--no-oxlint-type-aware` | Skip oxlint's type-aware rules (no `oxlint-tsgolint` needed). |
|
package/dist/cli.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import path from "node:path";
|
|
|
9
9
|
import { existsSync, readFileSync } from "fs";
|
|
10
10
|
import { execSync } from "node:child_process";
|
|
11
11
|
//#region package.json
|
|
12
|
-
var version = "6.0.0-beta.
|
|
12
|
+
var version = "6.0.0-beta.46";
|
|
13
13
|
var package_default = {
|
|
14
14
|
name: "@isentinel/eslint-config",
|
|
15
15
|
version,
|
|
@@ -175,7 +175,7 @@ var package_default = {
|
|
|
175
175
|
},
|
|
176
176
|
peerDependencies: {
|
|
177
177
|
"@vitest/eslint-plugin": "^1.6.4",
|
|
178
|
-
"eslint": "^10.
|
|
178
|
+
"eslint": "^10.10.0",
|
|
179
179
|
"eslint-plugin-eslint-plugin": "^7.5.0",
|
|
180
180
|
"eslint-plugin-jest": "^29.15.0",
|
|
181
181
|
"eslint-plugin-jest-extended": "^3.0.0",
|
|
@@ -534,7 +534,7 @@ async function updateEslintFiles(result) {
|
|
|
534
534
|
//#endregion
|
|
535
535
|
//#region src/cli/constants-generated.ts
|
|
536
536
|
const versionsMap = {
|
|
537
|
-
"eslint": "10.
|
|
537
|
+
"eslint": "10.10.0",
|
|
538
538
|
"eslint-plugin-jest": "29.16.0",
|
|
539
539
|
"eslint-plugin-react-jsx": "5.17.3",
|
|
540
540
|
"eslint-plugin-react-naming-convention": "5.17.3",
|
package/dist/index.d.mts
CHANGED
|
@@ -1510,7 +1510,9 @@ interface MainRuleDefaults {
|
|
|
1510
1510
|
"*": "off";
|
|
1511
1511
|
};
|
|
1512
1512
|
"no-unmodified-loop-condition": {
|
|
1513
|
-
"*": "error"
|
|
1513
|
+
"*": ["error", {
|
|
1514
|
+
"checkConditionalExpressions": false;
|
|
1515
|
+
}];
|
|
1514
1516
|
};
|
|
1515
1517
|
"no-unneeded-ternary": {
|
|
1516
1518
|
"*": ["error", {
|
|
@@ -6498,7 +6500,7 @@ interface OverrideSiteChains {
|
|
|
6498
6500
|
type TestChain = [TestRuleDefaults, SourceFeatureRuleDefaults, MainRuleDefaults];
|
|
6499
6501
|
type ValidateOptionsWith<O, VK extends VariantKey> = ValidateSite<O, "rules", MainChain, VK> & ValidateSubOptionsFromTable<O, OverrideSiteChains, VK> & ValidateTestOption<O, TestChain, VK>;
|
|
6500
6502
|
//#endregion
|
|
6501
|
-
//#region ../../../setup-pnpm/node_modules/.bin/store/v11/links/@/eslint-config-flat-gitignore/2.3.0/
|
|
6503
|
+
//#region ../../../setup-pnpm/node_modules/.bin/store/v11/links/@/eslint-config-flat-gitignore/2.3.0/48bee61dfbd6416cb227d1c477eb8990bf234fa634e4ccd62a9520a90cc26602/node_modules/eslint-config-flat-gitignore/dist/index.d.mts
|
|
6502
6504
|
interface FlatGitignoreOptions {
|
|
6503
6505
|
/**
|
|
6504
6506
|
* Name of the configuration.
|
|
@@ -9343,7 +9345,7 @@ interface RuleOptions {
|
|
|
9343
9345
|
* Disallow unmodified loop conditions
|
|
9344
9346
|
* @see https://eslint.org/docs/latest/rules/no-unmodified-loop-condition
|
|
9345
9347
|
*/
|
|
9346
|
-
'no-unmodified-loop-condition'?: Linter.RuleEntry<
|
|
9348
|
+
'no-unmodified-loop-condition'?: Linter.RuleEntry<NoUnmodifiedLoopCondition>;
|
|
9347
9349
|
/**
|
|
9348
9350
|
* Disallow ternary operators when simpler alternatives exist
|
|
9349
9351
|
* @see https://eslint.org/docs/latest/rules/no-unneeded-ternary
|
|
@@ -19662,6 +19664,10 @@ type NoUnderscoreDangle = [] | [{
|
|
|
19662
19664
|
allowInArrayDestructuring?: boolean;
|
|
19663
19665
|
allowInObjectDestructuring?: boolean;
|
|
19664
19666
|
}];
|
|
19667
|
+
// ----- no-unmodified-loop-condition -----
|
|
19668
|
+
type NoUnmodifiedLoopCondition = [] | [{
|
|
19669
|
+
checkConditionalExpressions?: boolean;
|
|
19670
|
+
}];
|
|
19665
19671
|
// ----- no-unneeded-ternary -----
|
|
19666
19672
|
type NoUnneededTernary = [] | [{
|
|
19667
19673
|
defaultAssignment?: boolean;
|
package/dist/index.mjs
CHANGED
|
@@ -1889,7 +1889,7 @@ async function flawless(options = {}, prettierOptions = {}) {
|
|
|
1889
1889
|
];
|
|
1890
1890
|
}
|
|
1891
1891
|
//#endregion
|
|
1892
|
-
//#region ../../../setup-pnpm/node_modules/.bin/store/v11/links/@eslint/compat/2.1.0/
|
|
1892
|
+
//#region ../../../setup-pnpm/node_modules/.bin/store/v11/links/@eslint/compat/2.1.0/c5793be99df3f1294a68a791ed84f1ed609714ef294e5fa5fdeeff97455db3c8/node_modules/@eslint/compat/dist/esm/index.js
|
|
1893
1893
|
/**
|
|
1894
1894
|
* @fileoverview Ignore file utilities for the compat package.
|
|
1895
1895
|
* @author Nicholas C. Zakas
|
|
@@ -1918,7 +1918,7 @@ function convertIgnorePatternToMinimatch(pattern) {
|
|
|
1918
1918
|
}
|
|
1919
1919
|
var init_esm$1 = __esmMin((() => {}));
|
|
1920
1920
|
//#endregion
|
|
1921
|
-
//#region ../../../setup-pnpm/node_modules/.bin/store/v11/links/@/eslint-config-flat-gitignore/2.3.0/
|
|
1921
|
+
//#region ../../../setup-pnpm/node_modules/.bin/store/v11/links/@/eslint-config-flat-gitignore/2.3.0/48bee61dfbd6416cb227d1c477eb8990bf234fa634e4ccd62a9520a90cc26602/node_modules/eslint-config-flat-gitignore/dist/index.mjs
|
|
1922
1922
|
var dist_exports = /* @__PURE__ */ __exportAll$2({ default: () => ignore });
|
|
1923
1923
|
function toArray(array) {
|
|
1924
1924
|
array = array ?? [];
|
|
@@ -3932,6 +3932,7 @@ async function pnpm(options) {
|
|
|
3932
3932
|
"pnpm/yaml-enforce-settings": ["error", { settings: {
|
|
3933
3933
|
catalogMode: "prefer",
|
|
3934
3934
|
cleanupUnusedCatalogs: true,
|
|
3935
|
+
minimumReleaseAgeExcludePrune: true,
|
|
3935
3936
|
shellEmulator: true,
|
|
3936
3937
|
trustPolicy: "no-downgrade",
|
|
3937
3938
|
trustPolicyIgnoreAfter: 10080
|
|
@@ -4907,6 +4908,7 @@ function sortPnpmWorkspace() {
|
|
|
4907
4908
|
"blockExoticSubdeps",
|
|
4908
4909
|
"cacheDir",
|
|
4909
4910
|
"catalogMode",
|
|
4911
|
+
"catalogPrune",
|
|
4910
4912
|
"cleanupUnusedCatalogs",
|
|
4911
4913
|
"dedupeDirectDeps",
|
|
4912
4914
|
"dedupePeerDependents",
|
|
@@ -4916,6 +4918,7 @@ function sortPnpmWorkspace() {
|
|
|
4916
4918
|
"enablePrePostScripts",
|
|
4917
4919
|
"engineStrict",
|
|
4918
4920
|
"extendNodePath",
|
|
4921
|
+
"globalShims",
|
|
4919
4922
|
"hoist",
|
|
4920
4923
|
"hoistPattern",
|
|
4921
4924
|
"hoistWorkspacePackages",
|
|
@@ -4931,6 +4934,7 @@ function sortPnpmWorkspace() {
|
|
|
4931
4934
|
"managePackageManagerVersions",
|
|
4932
4935
|
"minimumReleaseAge",
|
|
4933
4936
|
"minimumReleaseAgeExclude",
|
|
4937
|
+
"minimumReleaseAgeExcludePrune",
|
|
4934
4938
|
"minimumReleaseAgeIgnoreMissingTime",
|
|
4935
4939
|
"minimumReleaseAgeStrict",
|
|
4936
4940
|
"modulesDir",
|
|
@@ -4953,6 +4957,7 @@ function sortPnpmWorkspace() {
|
|
|
4953
4957
|
"shamefullyHoist",
|
|
4954
4958
|
"sharedWorkspaceLockfile",
|
|
4955
4959
|
"shellEmulator",
|
|
4960
|
+
"sideEffectsCache",
|
|
4956
4961
|
"stateDir",
|
|
4957
4962
|
"strictDepBuilds",
|
|
4958
4963
|
"strictPeerDependencies",
|
|
@@ -4965,7 +4970,8 @@ function sortPnpmWorkspace() {
|
|
|
4965
4970
|
"trustPolicyIgnoreAfter",
|
|
4966
4971
|
"updateConfig",
|
|
4967
4972
|
"updateNotifier",
|
|
4968
|
-
"verifyDepsBeforeRun"
|
|
4973
|
+
"verifyDepsBeforeRun",
|
|
4974
|
+
"virtualStoreType"
|
|
4969
4975
|
],
|
|
4970
4976
|
...[
|
|
4971
4977
|
"gitBranchLockfile",
|
|
@@ -4992,7 +4998,8 @@ function sortPnpmWorkspace() {
|
|
|
4992
4998
|
"onlyBuiltDependencies",
|
|
4993
4999
|
"onlyBuiltDependenciesFile",
|
|
4994
5000
|
"packageExtensions",
|
|
4995
|
-
"peerDependencyRules"
|
|
5001
|
+
"peerDependencyRules",
|
|
5002
|
+
"tasks"
|
|
4996
5003
|
],
|
|
4997
5004
|
{ order: { type: "asc" } }
|
|
4998
5005
|
],
|
|
@@ -5017,7 +5024,7 @@ function sortPnpmWorkspace() {
|
|
|
5017
5024
|
natural: true,
|
|
5018
5025
|
type: "asc"
|
|
5019
5026
|
},
|
|
5020
|
-
pathPattern: "^(supportedArchitectures\\.(cpu|libc|os)|updateConfig\\.ignoreDependencies|peerDependencyRules\\.(allowAny|ignoreMissing)|auditConfig\\.(ignoreCves|ignoreGhsas))$"
|
|
5027
|
+
pathPattern: "^(supportedArchitectures\\.(cpu|libc|os)|update\\.ignoreDeps|updateConfig\\.ignoreDependencies|peerDependencyRules\\.(allowAny|ignoreMissing)|audit\\.ignore|auditConfig\\.(ignoreCves|ignoreGhsas)|sideEffectsCache\\.remote\\.packages|tasks\\.[^.]+\\.dependsOn)$"
|
|
5021
5028
|
}
|
|
5022
5029
|
]
|
|
5023
5030
|
}
|
|
@@ -6243,7 +6250,7 @@ async function unicorn({ complementIgnores, nameReplacements, roblox = true, roo
|
|
|
6243
6250
|
];
|
|
6244
6251
|
}
|
|
6245
6252
|
//#endregion
|
|
6246
|
-
//#region ../../../setup-pnpm/node_modules/.bin/store/v11/links/@/eslint-plugin-yml/3.5.0/
|
|
6253
|
+
//#region ../../../setup-pnpm/node_modules/.bin/store/v11/links/@/eslint-plugin-yml/3.5.0/eedfb7e8cfd566a06319a5894d49f61723d6a8793c9b4a69e6556dd999563774/node_modules/eslint-plugin-yml/lib/chunk-CfYAbeIz.mjs
|
|
6247
6254
|
var __defProp$1, __exportAll$1;
|
|
6248
6255
|
var init_chunk_CfYAbeIz = __esmMin((() => {
|
|
6249
6256
|
__defProp$1 = Object.defineProperty;
|
|
@@ -9426,7 +9433,7 @@ var init_lib$1 = __esmMin((() => {
|
|
|
9426
9433
|
({ ...meta_exports$1 });
|
|
9427
9434
|
}));
|
|
9428
9435
|
//#endregion
|
|
9429
|
-
//#region ../../../setup-pnpm/node_modules/.bin/store/v11/links/@/eslint-plugin-yml/3.5.0/
|
|
9436
|
+
//#region ../../../setup-pnpm/node_modules/.bin/store/v11/links/@/eslint-plugin-yml/3.5.0/eedfb7e8cfd566a06319a5894d49f61723d6a8793c9b4a69e6556dd999563774/node_modules/eslint-plugin-yml/lib/index.mjs
|
|
9430
9437
|
var lib_exports = /* @__PURE__ */ __exportAll$2({
|
|
9431
9438
|
configs: () => configs,
|
|
9432
9439
|
default: () => src_default,
|
|
@@ -19839,8 +19846,10 @@ var oxlint_drop_exports = /* @__PURE__ */ __exportAll$2({
|
|
|
19839
19846
|
* Warn when a user-supplied config references a rule that oxlint owns in hybrid
|
|
19840
19847
|
* mode (`oxlint: true`). The preset drops every oxlint-covered rule from the
|
|
19841
19848
|
* ESLint side and lets oxlint format real JS/TS files, so such entries silently
|
|
19842
|
-
* do nothing.
|
|
19843
|
-
* virtual files, so the preset re-enables those
|
|
19849
|
+
* do nothing. Configs oxlint cannot reach are exempt: Markdown-scoped ones
|
|
19850
|
+
* (oxlint cannot lint Markdown virtual files, so the preset re-enables those
|
|
19851
|
+
* rules there) and ones scoped to a non-JS/TS language, which oxlint never
|
|
19852
|
+
* parses.
|
|
19844
19853
|
*
|
|
19845
19854
|
* @param configs - The resolved flat config items.
|
|
19846
19855
|
* @param mode - The hybrid mode; in `native` mode jsPlugin rules and formatting
|
|
@@ -19870,6 +19879,11 @@ function warnMissingTsgolint() {
|
|
|
19870
19879
|
* sibling is inserted directly after the original so later configs (for
|
|
19871
19880
|
* example the markdown disables) still take precedence.
|
|
19872
19881
|
*
|
|
19882
|
+
* Configs scoped to a language oxlint does not parse are skipped outright: it
|
|
19883
|
+
* reads only the JS/TS family, so handing it `oxfmt/oxfmt` for YAML, JSON, CSS
|
|
19884
|
+
* or GraphQL would drop the formatter from ESLint without any engine picking it
|
|
19885
|
+
* up. See {@link targetsJsOrTs}.
|
|
19886
|
+
*
|
|
19873
19887
|
* @param configs - The resolved flat config items (mutated in place).
|
|
19874
19888
|
* @param typeAware - Whether oxlint runs type-aware (oxlint-tsgolint present).
|
|
19875
19889
|
* When `false`, tsgolint rules are kept in ESLint so they do not vanish from
|
|
@@ -19879,7 +19893,7 @@ function warnMissingTsgolint() {
|
|
|
19879
19893
|
function dropOxlintCoveredRules(configs, typeAware = true, mode = "full") {
|
|
19880
19894
|
for (let index = 0; index < configs.length; index += 1) {
|
|
19881
19895
|
const config = configs[index];
|
|
19882
|
-
if (config?.name === void 0 || !config.name.startsWith("isentinel/") || config.name.endsWith("/markdown-code") || config.rules === void 0 || targetsMarkdown(config.files)) continue;
|
|
19896
|
+
if (config?.name === void 0 || !config.name.startsWith("isentinel/") || config.name.endsWith("/markdown-code") || config.rules === void 0 || targetsMarkdown(config.files) || !targetsJsOrTs(config.files)) continue;
|
|
19883
19897
|
const dropped = dropCoveredRulesFromConfig(config.rules, typeAware, mode);
|
|
19884
19898
|
if (Object.keys(dropped).length === 0) continue;
|
|
19885
19899
|
if ((config.ignores ?? []).some((pattern) => typeof pattern === "string" && pattern.includes(".md/"))) continue;
|
|
@@ -19928,10 +19942,98 @@ function targetsMarkdown(files) {
|
|
|
19928
19942
|
const patterns = files.flat();
|
|
19929
19943
|
return patterns.length > 0 && patterns.every((pattern) => typeof pattern === "string" && pattern.includes(".md"));
|
|
19930
19944
|
}
|
|
19945
|
+
/**
|
|
19946
|
+
* The strings one part of a {@link GLOB_GROUP_SPLIT} split can stand for: the
|
|
19947
|
+
* comma-separated members of a brace group, the individual characters of a
|
|
19948
|
+
* bracket group, or the literal text itself. A part that still holds a group
|
|
19949
|
+
* delimiter is a nested or unterminated group, which is not expanded.
|
|
19950
|
+
*
|
|
19951
|
+
* @param part - One part of a glob fragment split on its groups.
|
|
19952
|
+
* @returns The alternatives, or `undefined` when the part is not expandable.
|
|
19953
|
+
*/
|
|
19954
|
+
function groupAlternatives(part) {
|
|
19955
|
+
const body = part.slice(1, -1);
|
|
19956
|
+
if (part.startsWith("{")) return body.split(",");
|
|
19957
|
+
if (part.startsWith("[")) return body.match(GLOB_ANY_CHARACTER) ?? [];
|
|
19958
|
+
return GLOB_GROUP_DELIMITER.test(part) ? void 0 : [part];
|
|
19959
|
+
}
|
|
19960
|
+
/**
|
|
19961
|
+
* Expand the brace and character-class alternatives of a glob fragment.
|
|
19962
|
+
*
|
|
19963
|
+
* Only the closed forms the preset's globs use are handled (`{,c,m}`, `[jt]`);
|
|
19964
|
+
* anything with a wildcard, a nested group or an unterminated group yields
|
|
19965
|
+
* `undefined`, meaning "could be anything". Callers treat that as a match, so
|
|
19966
|
+
* an unknown pattern keeps the pre-existing drop behavior.
|
|
19967
|
+
*
|
|
19968
|
+
* @param fragment - The glob fragment to expand.
|
|
19969
|
+
* @returns Every literal string the fragment can produce, or `undefined` when
|
|
19970
|
+
* the fragment is not a closed set of literals.
|
|
19971
|
+
*/
|
|
19972
|
+
function expandGlobAlternatives(fragment) {
|
|
19973
|
+
if (GLOB_WILDCARD.test(fragment)) return;
|
|
19974
|
+
let results = [""];
|
|
19975
|
+
for (const part of fragment.split(GLOB_GROUP_SPLIT)) {
|
|
19976
|
+
const alternatives = groupAlternatives(part);
|
|
19977
|
+
if (alternatives === void 0) return;
|
|
19978
|
+
results = results.flatMap((prefix) => {
|
|
19979
|
+
return alternatives.map((alternative) => prefix + alternative);
|
|
19980
|
+
});
|
|
19981
|
+
}
|
|
19982
|
+
return results;
|
|
19983
|
+
}
|
|
19984
|
+
/**
|
|
19985
|
+
* The index of the extension dot in a glob's last path segment, or `-1` when it
|
|
19986
|
+
* has none. Dots inside a brace or bracket group are masked out first: they
|
|
19987
|
+
* belong to an alternative, not to the extension boundary.
|
|
19988
|
+
*
|
|
19989
|
+
* @param segment - The last path segment of a `files` pattern.
|
|
19990
|
+
* @returns The index of the extension dot, or `-1`.
|
|
19991
|
+
*/
|
|
19992
|
+
function extensionDotIndex(segment) {
|
|
19993
|
+
return segment.replaceAll(GLOB_GROUP, (group) => "\0".repeat(group.length)).lastIndexOf(".");
|
|
19994
|
+
}
|
|
19995
|
+
/**
|
|
19996
|
+
* Whether a single `files` pattern can match a file oxlint reads.
|
|
19997
|
+
*
|
|
19998
|
+
* Oxlint parses only the JS/TS family, so a pattern whose extension is a closed
|
|
19999
|
+
* set of non-JS/TS extensions (`**\/*.y{,a}ml`, `**\/*.json{,5,c}`) describes
|
|
20000
|
+
* files oxlint never sees. A pattern whose last segment has no extension, or
|
|
20001
|
+
* whose extension is not a closed set, matches conservatively.
|
|
20002
|
+
*
|
|
20003
|
+
* @param pattern - The `files` pattern to classify.
|
|
20004
|
+
* @returns Whether oxlint can lint something the pattern matches.
|
|
20005
|
+
*/
|
|
20006
|
+
function patternTargetsJsOrTs(pattern) {
|
|
20007
|
+
const segment = pattern.slice(pattern.lastIndexOf("/") + 1);
|
|
20008
|
+
const dot = extensionDotIndex(segment);
|
|
20009
|
+
if (dot === -1) return true;
|
|
20010
|
+
const extensions = expandGlobAlternatives(segment.slice(dot + 1));
|
|
20011
|
+
if (extensions === void 0) return true;
|
|
20012
|
+
return extensions.some((extension) => JS_TS_EXTENSIONS.has(extension));
|
|
20013
|
+
}
|
|
20014
|
+
/**
|
|
20015
|
+
* Whether a config's `files` reach any file oxlint can lint.
|
|
20016
|
+
*
|
|
20017
|
+
* Hybrid mode only hands a rule to oxlint for the files oxlint actually parses.
|
|
20018
|
+
* A config scoped to YAML, JSON, CSS or GraphQL is invisible to oxlint, so its
|
|
20019
|
+
* rules must stay in ESLint or they run in neither engine — the case that
|
|
20020
|
+
* silently dropped `oxfmt/oxfmt` from every non-JS formatting config.
|
|
20021
|
+
*
|
|
20022
|
+
* @param files - The config's `files` patterns; nested arrays are AND-combined,
|
|
20023
|
+
* so they only reach JS/TS when every member does.
|
|
20024
|
+
* @returns Whether oxlint can lint something the config targets.
|
|
20025
|
+
*/
|
|
20026
|
+
function targetsJsOrTs(files) {
|
|
20027
|
+
if (files === void 0 || files.length === 0) return true;
|
|
20028
|
+
return files.some((entry) => {
|
|
20029
|
+
if (typeof entry === "string") return patternTargetsJsOrTs(entry);
|
|
20030
|
+
return entry.every((pattern) => patternTargetsJsOrTs(pattern));
|
|
20031
|
+
});
|
|
20032
|
+
}
|
|
19931
20033
|
function findDeadMappedRules(configs, mode) {
|
|
19932
20034
|
const references = [];
|
|
19933
20035
|
for (const config of configs) {
|
|
19934
|
-
if (config.rules === void 0 || isPresetConfig(config) || targetsMarkdown(config.files)) continue;
|
|
20036
|
+
if (config.rules === void 0 || isPresetConfig(config) || targetsMarkdown(config.files) || !targetsJsOrTs(config.files)) continue;
|
|
19935
20037
|
const label = describeConfig(config);
|
|
19936
20038
|
for (const [rule, value] of Object.entries(config.rules)) if (value !== void 0 && (presetHandsRuleToOxlint(rule, mode) || mode === "full" && HYBRID_FORMATTING_RULES.has(rule))) references.push({
|
|
19937
20039
|
config: label,
|
|
@@ -19992,11 +20094,17 @@ function markdownVirtualFiles(files) {
|
|
|
19992
20094
|
return [GLOB_MARKDOWN_CODE, ...[pattern].flat()];
|
|
19993
20095
|
});
|
|
19994
20096
|
}
|
|
19995
|
-
var HYBRID_FORMATTING_RULES;
|
|
20097
|
+
var HYBRID_FORMATTING_RULES, JS_TS_EXTENSIONS, GLOB_WILDCARD, GLOB_GROUP, GLOB_GROUP_SPLIT, GLOB_GROUP_DELIMITER, GLOB_ANY_CHARACTER;
|
|
19996
20098
|
var init_oxlint_drop = __esmMin((() => {
|
|
19997
20099
|
init_globs();
|
|
19998
20100
|
init_routing();
|
|
19999
20101
|
HYBRID_FORMATTING_RULES = /* @__PURE__ */ new Set(["oxfmt/oxfmt"]);
|
|
20102
|
+
JS_TS_EXTENSIONS = new Set(GLOB_SRC_EXTENSIONS);
|
|
20103
|
+
GLOB_WILDCARD = /[*?]/;
|
|
20104
|
+
GLOB_GROUP = /\{[^{}]*\}|\[[^[\]]*\]/gu;
|
|
20105
|
+
GLOB_GROUP_SPLIT = /(\{[^{}]*\}|\[[^[\]]*\])/u;
|
|
20106
|
+
GLOB_GROUP_DELIMITER = /[{}[\]]/u;
|
|
20107
|
+
GLOB_ANY_CHARACTER = /./gu;
|
|
20000
20108
|
}));
|
|
20001
20109
|
//#endregion
|
|
20002
20110
|
//#region src/eslint/factory.ts
|