oxlint-plugin-react-doctor 0.9.2-dev.c6bdd2d → 0.9.2-dev.d81eeda

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/dist/index.d.ts CHANGED
@@ -1,155 +1,5 @@
1
- import { StaticImport } from "oxc-parser";
2
- import { TSESTree } from "@typescript-eslint/types";
1
+ import { C as FileScan, D as CapabilityQuery, E as Capability, O as FRAMEWORK_TOKENS, S as EsTreeNode, T as ScannedFile, _ as RuleFramework, a as shouldReadSecurityScanContent, b as BaseRuleContext, c as UNBOUNDED_CROSS_FILE_RULE_IDS, d as CROSS_FILE_RULE_IDS, f as MOTION_LIBRARY_PACKAGES, g as Rule, h as OxlintRuleSeverity, i as classifySecurityScanFile, k as FrameworkToken, l as collectCrossFileDependencyProbes, m as REACT_COMPILER_RULES, n as REACT_NATIVE_DEPENDENCY_PREFIXES, o as resetFilesystemCaches, p as EXTERNAL_RULES, r as isReactNativeDependencyName, s as CROSS_FILE_DEPENDENCY_COLLECTORS, t as REACT_NATIVE_DEPENDENCY_NAMES, u as CrossFileProbeTrace, v as RuleSeverity, w as ScanFinding, x as RuleContext, y as RuleVisitors } from "./react-native-dependency-names-DrsRME-d.js";
3
2
 
4
- //#region src/plugin/utils/es-tree-node.d.ts
5
- type WithLooseParent<NodeType> = NodeType extends NodeType ? Omit<NodeType, "parent"> & {
6
- parent?: EsTreeNode | null;
7
- } : never;
8
- type EsTreeNode = WithLooseParent<TSESTree.Node>;
9
- //#endregion
10
- //#region src/plugin/utils/report-descriptor.d.ts
11
- interface ReportDescriptor {
12
- node: EsTreeNode;
13
- message: string;
14
- }
15
- //#endregion
16
- //#region src/plugin/semantic/control-flow-graph.d.ts
17
- type CfgEdgeKind = "uncond" | "cond" | "throw";
18
- interface CfgEdge {
19
- readonly from: BasicBlock;
20
- readonly to: BasicBlock;
21
- readonly kind: CfgEdgeKind;
22
- }
23
- interface BasicBlock {
24
- readonly id: number;
25
- readonly nodes: EsTreeNode[];
26
- readonly successors: CfgEdge[];
27
- readonly predecessors: CfgEdge[];
28
- }
29
- interface FunctionCfg {
30
- readonly owner: EsTreeNode;
31
- readonly entry: BasicBlock;
32
- readonly exit: BasicBlock;
33
- readonly blocks: BasicBlock[];
34
- readonly blockOf: (node: EsTreeNode) => BasicBlock | null;
35
- }
36
- interface ControlFlowAnalysis {
37
- readonly cfgFor: (functionLike: EsTreeNode) => FunctionCfg | null;
38
- readonly enclosingFunction: (node: EsTreeNode) => EsTreeNode | null;
39
- readonly isUnconditionalFromEntry: (node: EsTreeNode) => boolean;
40
- }
41
- //#endregion
42
- //#region src/plugin/semantic/scope-analysis.d.ts
43
- type SymbolKind = "var" | "let" | "const" | "using" | "function" | "class" | "parameter" | "import" | "ts-import-equals" | "ts-enum" | "ts-type-alias" | "ts-interface" | "ts-module" | "catch-clause-parameter";
44
- type ScopeKind = "module" | "function" | "arrow-function" | "method" | "block" | "class" | "catch" | "for" | "switch" | "with" | "ts-module" | "ts-enum";
45
- interface SymbolDescriptor {
46
- readonly id: number;
47
- readonly name: string;
48
- readonly kind: SymbolKind;
49
- readonly bindingIdentifier: EsTreeNode;
50
- readonly declarationNode: EsTreeNode;
51
- readonly scope: ScopeDescriptor;
52
- readonly initializer: EsTreeNode | null;
53
- readonly references: ReferenceDescriptor[];
54
- }
55
- type ReferenceFlag = "read" | "write" | "read-write";
56
- interface ReferenceDescriptor {
57
- readonly id: number;
58
- readonly identifier: EsTreeNode;
59
- resolvedSymbol: SymbolDescriptor | null;
60
- readonly flag: ReferenceFlag;
61
- readonly scope: ScopeDescriptor;
62
- }
63
- interface ScopeDescriptor {
64
- readonly id: number;
65
- readonly kind: ScopeKind;
66
- readonly node: EsTreeNode;
67
- readonly parent: ScopeDescriptor | null;
68
- readonly children: ScopeDescriptor[];
69
- readonly symbols: SymbolDescriptor[];
70
- readonly references: ReferenceDescriptor[];
71
- readonly symbolsByName: Map<string, SymbolDescriptor>;
72
- }
73
- interface ScopeAnalysis {
74
- readonly rootScope: ScopeDescriptor;
75
- readonly scopeFor: (node: EsTreeNode) => ScopeDescriptor;
76
- readonly ownScopeFor: (node: EsTreeNode) => ScopeDescriptor | null;
77
- readonly symbolFor: (identifier: EsTreeNode) => SymbolDescriptor | null;
78
- readonly referenceFor: (identifier: EsTreeNode) => ReferenceDescriptor | null;
79
- readonly isGlobalReference: (identifier: EsTreeNode) => boolean;
80
- }
81
- //#endregion
82
- //#region src/plugin/utils/rule-context.d.ts
83
- interface BaseRuleContext {
84
- report: (descriptor: ReportDescriptor) => void;
85
- readonly filename?: string;
86
- /**
87
- * @deprecated Rules use `context.filename`. Read only as a fallback by
88
- * `wrapWithSemanticContext`; ESLint implements it as a `this`-bound class
89
- * method, so it must be called on the host context, never a detached
90
- * reference.
91
- */
92
- getFilename?: () => string | undefined;
93
- readonly settings?: Readonly<Record<string, unknown>>;
94
- }
95
- interface RuleContext extends Omit<BaseRuleContext, "getFilename"> {
96
- readonly scopes: ScopeAnalysis;
97
- readonly cfg: ControlFlowAnalysis;
98
- }
99
- //#endregion
100
- //#region src/plugin/utils/capability.d.ts
101
- declare const FRAMEWORK_TOKENS: readonly ["nextjs", "astro", "vite", "cra", "remix", "gatsby", "expo", "react-native", "tanstack-start", "preact", "unknown"];
102
- type FrameworkToken = (typeof FRAMEWORK_TOKENS)[number];
103
- type Capability = FrameworkToken | "react" | "remotion" | "pure-preact" | "react-native" | "server-actions" | "ssr" | "client-only" | "expo:54" | "nextjs:static-export" | "nextjs:15" | "nextjs:16" | "tailwind" | "tailwind:3.4" | "tailwind:4" | "zod" | "zod:4" | "mobx" | "mobx-react" | "mobx-react-lite" | "mobx-react-binding" | "mobx-react-binding-observer-memo-guard" | "mobx-react-observer-memo-guard" | "mobx-react-lite-observer-memo-guard" | "mobx-state-tree" | "mobx-react-observer" | "zustand" | "typescript" | "react-compiler" | "reanimated" | "reanimated:4" | "tanstack-query" | "valtio" | "i18n" | "styled-components" | "styled-components:6" | "three" | "r3f" | "react-router" | "react-router-framework" | "react-router:6.4" | "react-router:6.7" | "react-router:6.9" | "react-router:6.19" | "react-router:7" | "react-router:7.8" | "react-router:7.9" | "react-router:7.10" | "react-router:7.15" | "react-router:8" | "pre-es2023" | "target-blank-needs-explicit-protection" | "target-blank-needs-noreferrer" | `react:${number}` | `preact:${number}` | `remotion:${number}` | `valtio:${number}` | `mobx:${number}` | `zustand:${number}` | `three:${number}` | `r3f:${number}`;
104
- type CapabilityQuery = (capability: Capability) => boolean;
105
- //#endregion
106
- //#region src/plugin/utils/file-scan.d.ts
107
- interface ScannedFile {
108
- readonly absolutePath: string;
109
- readonly relativePath: string;
110
- readonly content: string;
111
- readonly isGeneratedBundle: boolean;
112
- }
113
- interface ScanFinding {
114
- readonly message: string;
115
- readonly line: number;
116
- readonly column: number;
117
- readonly severity?: "error" | "warn";
118
- readonly title?: string;
119
- readonly help?: string;
120
- }
121
- interface FileScan {
122
- (file: ScannedFile): ScanFinding[];
123
- }
124
- //#endregion
125
- //#region src/plugin/utils/rule-visitors.d.ts
126
- interface RuleVisitors {
127
- [selector: string]: ((node: any) => void) | (() => void);
128
- }
129
- //#endregion
130
- //#region src/plugin/utils/rule.d.ts
131
- type RuleSeverity = "error" | "warn";
132
- type RuleFramework = "global" | "nextjs" | "react-native" | "tanstack-start" | "tanstack-query" | "preact";
133
- interface Rule {
134
- id: string;
135
- title?: string;
136
- severity: RuleSeverity;
137
- category?: string;
138
- framework?: RuleFramework;
139
- requires?: ReadonlyArray<Capability>;
140
- minimumInkVersion?: string;
141
- disabledWhen?: ReadonlyArray<Capability>;
142
- tags?: ReadonlyArray<string>;
143
- matchByOccurrence?: boolean;
144
- defaultEnabled?: boolean;
145
- lifecycle?: "retired";
146
- scan?: FileScan;
147
- committedFilesOnly?: boolean;
148
- recommendation?: string;
149
- recommendationFor?: (hasCapability: CapabilityQuery) => string | undefined;
150
- create: (context: RuleContext) => RuleVisitors;
151
- }
152
- //#endregion
153
3
  //#region src/plugin/utils/rule-plugin.d.ts
154
4
  interface HostRule extends Omit<Rule, "create"> {
155
5
  create: (context: BaseRuleContext) => RuleVisitors;
@@ -164,9 +14,6 @@ interface RulePlugin {
164
14
  //#region src/plugin/react-doctor-plugin.d.ts
165
15
  declare const plugin: RulePlugin;
166
16
  //#endregion
167
- //#region src/types.d.ts
168
- type OxlintRuleSeverity = RuleSeverity | "off";
169
- //#endregion
170
17
  //#region src/rules.d.ts
171
18
  declare const REACT_DOCTOR_RULES: readonly [{
172
19
  readonly key: "react-doctor/active-static-asset";
@@ -18913,71 +18760,6 @@ declare const REACT_DOCTOR_RULES: readonly [{
18913
18760
  readonly create: (context: RuleContext) => RuleVisitors;
18914
18761
  };
18915
18762
  }];
18916
- declare const EXTERNAL_RULES: readonly [{
18917
- readonly key: "react-hooks-js/set-state-in-render";
18918
- readonly source: "react-compiler";
18919
- readonly severity: "error";
18920
- }, {
18921
- readonly key: "react-hooks-js/immutability";
18922
- readonly source: "react-compiler";
18923
- readonly severity: "error";
18924
- }, {
18925
- readonly key: "react-hooks-js/refs";
18926
- readonly source: "react-compiler";
18927
- readonly severity: "error";
18928
- }, {
18929
- readonly key: "react-hooks-js/purity";
18930
- readonly source: "react-compiler";
18931
- readonly severity: "error";
18932
- }, {
18933
- readonly key: "react-hooks-js/hooks";
18934
- readonly source: "react-compiler";
18935
- readonly severity: "error";
18936
- }, {
18937
- readonly key: "react-hooks-js/set-state-in-effect";
18938
- readonly source: "react-compiler";
18939
- readonly severity: "warn";
18940
- }, {
18941
- readonly key: "react-hooks-js/globals";
18942
- readonly source: "react-compiler";
18943
- readonly severity: "error";
18944
- }, {
18945
- readonly key: "react-hooks-js/error-boundaries";
18946
- readonly source: "react-compiler";
18947
- readonly severity: "error";
18948
- }, {
18949
- readonly key: "react-hooks-js/preserve-manual-memoization";
18950
- readonly source: "react-compiler";
18951
- readonly severity: "error";
18952
- }, {
18953
- readonly key: "react-hooks-js/unsupported-syntax";
18954
- readonly source: "react-compiler";
18955
- readonly severity: "error";
18956
- }, {
18957
- readonly key: "react-hooks-js/component-hook-factories";
18958
- readonly source: "react-compiler";
18959
- readonly severity: "error";
18960
- }, {
18961
- readonly key: "react-hooks-js/static-components";
18962
- readonly source: "react-compiler";
18963
- readonly severity: "error";
18964
- }, {
18965
- readonly key: "react-hooks-js/use-memo";
18966
- readonly source: "react-compiler";
18967
- readonly severity: "error";
18968
- }, {
18969
- readonly key: "react-hooks-js/void-use-memo";
18970
- readonly source: "react-compiler";
18971
- readonly severity: "error";
18972
- }, {
18973
- readonly key: "react-hooks-js/incompatible-library";
18974
- readonly source: "react-compiler";
18975
- readonly severity: "error";
18976
- }, {
18977
- readonly key: "react-hooks-js/todo";
18978
- readonly source: "react-compiler";
18979
- readonly severity: "error";
18980
- }];
18981
18763
  declare const RULES: readonly [{
18982
18764
  readonly key: "react-doctor/active-static-asset";
18983
18765
  readonly id: "active-static-asset";
@@ -37796,108 +37578,6 @@ declare const PREACT_RULES: Record<string, OxlintRuleSeverity>;
37796
37578
  declare const ALL_REACT_DOCTOR_RULES: Record<string, OxlintRuleSeverity>;
37797
37579
  declare const ALL_REACT_DOCTOR_RULE_KEYS: ReadonlySet<string>;
37798
37580
  declare const FRAMEWORK_SPECIFIC_RULE_KEYS: ReadonlySet<string>;
37799
- declare const REACT_COMPILER_RULES: Record<string, OxlintRuleSeverity>;
37800
- //#endregion
37801
- //#region src/plugin/constants/style.d.ts
37802
- declare const MOTION_LIBRARY_PACKAGES: Set<string>;
37803
- //#endregion
37804
- //#region src/plugin/constants/cross-file-rule-ids.d.ts
37805
- declare const CROSS_FILE_RULE_IDS: ReadonlySet<string>;
37806
- //#endregion
37807
- //#region src/plugin/utils/cross-file-probe-recorder.d.ts
37808
- interface CrossFileProbeTrace {
37809
- /** Paths whose existence classification (file / dir / none) was consulted. */
37810
- readonly existencePaths: Set<string>;
37811
- /** Paths whose content (bytes, exports, parse) was consulted. */
37812
- readonly contentPaths: Set<string>;
37813
- }
37814
- //#endregion
37815
- //#region src/plugin/cross-file-dependencies.d.ts
37816
- /**
37817
- * Per-rule cross-file dependency collectors — the foundation of the sidecar
37818
- * lint cache's dependency fingerprints (`@react-doctor/core`,
37819
- * `runners/oxlint/sidecar-lint-cache.ts`).
37820
- *
37821
- * A collector re-runs the SAME resolver helpers its rule calls at lint time
37822
- * (import resolution, barrel following, ancestor-layout walks, package.json
37823
- * classification) under the probe recorder
37824
- * (`utils/cross-file-probe-recorder.ts`), so the recorded probe set is the
37825
- * exact set of filesystem facts the rule's execution consulted — including
37826
- * the negative probes (extension candidates that did NOT exist) that make
37827
- * resolution shadowing detectable when a new file appears.
37828
- *
37829
- * SOUNDNESS INVARIANT — each collector's probe set must be a SUPERSET of
37830
- * every filesystem read its rule can make while linting the file, for any
37831
- * file content and any filesystem state:
37832
- *
37833
- * - Over-approximation is always safe (extra probes only cause a spurious
37834
- * re-lint); under-approximation is forbidden (a missed probe could
37835
- * replay a stale verdict).
37836
- * - Where a rule gates its cross-file reads on in-file conditions, a
37837
- * collector may skip the gate (probe more) or must mirror it EXACTLY
37838
- * (probe the same). Each collector documents which it does per gate.
37839
- * - The replay argument: the stored probe set is the complete read set of
37840
- * the collector's execution at store time. If every stored probe has
37841
- * the same answer on a later scan, re-executing the collector — and
37842
- * therefore the rule, whose reads are a subset — reproduces the same
37843
- * execution step by step (the file's own content is pinned separately
37844
- * by the cache key's content hash), so the stored diagnostics are
37845
- * exactly what a fresh sidecar lint would produce.
37846
- *
37847
- * A cross-file rule WITHOUT a collector here must be listed in
37848
- * `UNBOUNDED_CROSS_FILE_RULE_IDS` — it then re-lints every file on every
37849
- * scan (the sound fallback). `cross-file-rule-ids.test.ts` in
37850
- * `@react-doctor/core` forces every `CROSS_FILE_RULE_IDS` entry into
37851
- * exactly one of the two classifications.
37852
- */
37853
- interface CrossFileDependencyCollectorInput {
37854
- /** Absolute, forward-slash-normalized path of the file being fingerprinted. */
37855
- readonly absoluteFilePath: string;
37856
- readonly sourceText: string;
37857
- /** oxc module record — the file's static import declarations. */
37858
- readonly staticImports: ReadonlyArray<StaticImport>;
37859
- /** Parsed program (no parent references attached). */
37860
- readonly program: EsTreeNode;
37861
- }
37862
- type CrossFileDependencyCollector = (input: CrossFileDependencyCollectorInput) => void;
37863
- declare const CROSS_FILE_DEPENDENCY_COLLECTORS: ReadonlyMap<string, CrossFileDependencyCollector>;
37864
- /**
37865
- * Cross-file rules whose dependency set CANNOT be soundly bounded — they are
37866
- * excluded from fingerprinting and re-lint every file on every scan. A new
37867
- * cross-file rule must be added either here or to
37868
- * `CROSS_FILE_DEPENDENCY_COLLECTORS` (the core guard test enforces the
37869
- * partition), forcing a conscious classification.
37870
- */
37871
- declare const UNBOUNDED_CROSS_FILE_RULE_IDS: ReadonlySet<string>;
37872
- /**
37873
- * Runs the collectors for `ruleIds` over one file and returns every
37874
- * filesystem probe they made — the file's cross-file dependency set.
37875
- *
37876
- * Returns `null` (caller must treat the file as unfingerprintable and always
37877
- * re-lint it) when the file has a fatal parse error — an execution the
37878
- * collectors cannot mirror — or when a requested rule has no collector.
37879
- */
37880
- declare const collectCrossFileDependencyProbes: (input: {
37881
- absoluteFilePath: string;
37882
- sourceText: string;
37883
- ruleIds: ReadonlyArray<string>;
37884
- }) => CrossFileProbeTrace | null;
37885
- //#endregion
37886
- //#region src/plugin/utils/read-nearest-package-manifest.d.ts
37887
- declare const resetManifestCaches: () => void;
37888
- //#endregion
37889
- //#region src/plugin/rules/security-scan/utils/classify-security-scan-file.d.ts
37890
- interface SecurityScanFileClassification {
37891
- readonly bucket: "priority" | "artifact" | "other";
37892
- readonly isGeneratedBundleByName: boolean;
37893
- }
37894
- declare const classifySecurityScanFile: (relativePath: string) => SecurityScanFileClassification | null;
37895
- declare const shouldReadSecurityScanContent: (relativePath: string, isGeneratedBundle: boolean) => boolean;
37896
- //#endregion
37897
- //#region src/react-native-dependency-names.d.ts
37898
- declare const REACT_NATIVE_DEPENDENCY_NAMES: ReadonlySet<string>;
37899
- declare const REACT_NATIVE_DEPENDENCY_PREFIXES: ReadonlyArray<string>;
37900
- declare const isReactNativeDependencyName: (dependencyName: string) => boolean;
37901
37581
  //#endregion
37902
- export { ALL_REACT_DOCTOR_RULES, ALL_REACT_DOCTOR_RULE_KEYS, CROSS_FILE_DEPENDENCY_COLLECTORS, CROSS_FILE_RULE_IDS, type Capability, type CapabilityQuery, type CrossFileProbeTrace, EXTERNAL_RULES, type EsTreeNode, FRAMEWORK_SPECIFIC_RULE_KEYS, FRAMEWORK_TOKENS, type FileScan, type FrameworkToken, MOTION_LIBRARY_PACKAGES, NEXTJS_RULES, type OxlintRuleSeverity, PREACT_RULES, REACT_COMPILER_RULES, REACT_DOCTOR_RULES, REACT_NATIVE_DEPENDENCY_NAMES, REACT_NATIVE_DEPENDENCY_PREFIXES, REACT_NATIVE_RULES, RECOMMENDED_RULES, RULES, type Rule, type RuleFramework, type RulePlugin, type RuleSeverity, type RuleVisitors, type ScanFinding, type ScannedFile, TANSTACK_QUERY_RULES, TANSTACK_START_RULES, UNBOUNDED_CROSS_FILE_RULE_IDS, classifySecurityScanFile, collectCrossFileDependencyProbes, plugin as default, isReactNativeDependencyName, resetManifestCaches, shouldReadSecurityScanContent };
37582
+ export { ALL_REACT_DOCTOR_RULES, ALL_REACT_DOCTOR_RULE_KEYS, CROSS_FILE_DEPENDENCY_COLLECTORS, CROSS_FILE_RULE_IDS, type Capability, type CapabilityQuery, type CrossFileProbeTrace, EXTERNAL_RULES, type EsTreeNode, FRAMEWORK_SPECIFIC_RULE_KEYS, FRAMEWORK_TOKENS, type FileScan, type FrameworkToken, MOTION_LIBRARY_PACKAGES, NEXTJS_RULES, type OxlintRuleSeverity, PREACT_RULES, REACT_COMPILER_RULES, REACT_DOCTOR_RULES, REACT_NATIVE_DEPENDENCY_NAMES, REACT_NATIVE_DEPENDENCY_PREFIXES, REACT_NATIVE_RULES, RECOMMENDED_RULES, RULES, type Rule, type RuleFramework, type RulePlugin, type RuleSeverity, type RuleVisitors, type ScanFinding, type ScannedFile, TANSTACK_QUERY_RULES, TANSTACK_START_RULES, UNBOUNDED_CROSS_FILE_RULE_IDS, classifySecurityScanFile, collectCrossFileDependencyProbes, plugin as default, isReactNativeDependencyName, resetFilesystemCaches as resetManifestCaches, shouldReadSecurityScanContent };
37903
37583
  //# sourceMappingURL=index.d.ts.map