@pobammer-ts/eslint-cease-nonsense-rules 1.9.2 → 1.11.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 +139 -6
- package/dist/build-metadata.json +3 -3
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +678 -142
- package/dist/index.js.map +16 -10
- package/dist/rules/no-shorthand-names.d.ts +1 -0
- package/dist/rules/no-shorthand-names.d.ts.map +1 -1
- package/dist/rules/prefer-pattern-replacements.d.ts +13 -0
- package/dist/rules/prefer-pattern-replacements.d.ts.map +1 -0
- package/dist/rules/require-paired-calls.d.ts +18 -2
- package/dist/rules/require-paired-calls.d.ts.map +1 -1
- package/dist/rules/strict-component-boundaries.d.ts.map +1 -1
- package/dist/rules/use-exhaustive-dependencies.d.ts.map +1 -1
- package/dist/rules/use-hook-at-top-level.d.ts.map +1 -1
- package/dist/utilities/configure-utilities.d.ts +7 -0
- package/dist/utilities/configure-utilities.d.ts.map +1 -1
- package/dist/utilities/pattern-replacement/constant-folder.d.ts +24 -0
- package/dist/utilities/pattern-replacement/constant-folder.d.ts.map +1 -0
- package/dist/utilities/pattern-replacement/index.d.ts +7 -0
- package/dist/utilities/pattern-replacement/index.d.ts.map +1 -0
- package/dist/utilities/pattern-replacement/pattern-matcher.d.ts +62 -0
- package/dist/utilities/pattern-replacement/pattern-matcher.d.ts.map +1 -0
- package/dist/utilities/pattern-replacement/pattern-parser.d.ts +22 -0
- package/dist/utilities/pattern-replacement/pattern-parser.d.ts.map +1 -0
- package/dist/utilities/pattern-replacement/pattern-types.d.ts +69 -0
- package/dist/utilities/pattern-replacement/pattern-types.d.ts.map +1 -0
- package/dist/utilities/pattern-replacement/replacement-generator.d.ts +16 -0
- package/dist/utilities/pattern-replacement/replacement-generator.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Rule } from "eslint";
|
|
2
2
|
export interface NoShorthandOptions {
|
|
3
3
|
readonly allowPropertyAccess?: ReadonlyArray<string>;
|
|
4
|
+
readonly ignoreShorthands?: ReadonlyArray<string>;
|
|
4
5
|
readonly shorthands?: Record<string, string>;
|
|
5
6
|
}
|
|
6
7
|
declare const noShorthandNames: Rule.RuleModule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-shorthand-names.d.ts","sourceRoot":"","sources":["../../src/rules/no-shorthand-names.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAInC,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACrD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7C;
|
|
1
|
+
{"version":3,"file":"no-shorthand-names.d.ts","sourceRoot":"","sources":["../../src/rules/no-shorthand-names.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAInC,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACrD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAClD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7C;AAwPD,QAAA,MAAM,gBAAgB,EAAE,IAAI,CAAC,UAgL5B,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TSESLint } from "@typescript-eslint/utils";
|
|
2
|
+
import type { Pattern } from "../utilities/pattern-replacement";
|
|
3
|
+
interface PreferPatternReplacementsOptions {
|
|
4
|
+
readonly patterns: ReadonlyArray<Pattern>;
|
|
5
|
+
}
|
|
6
|
+
type Options = [PreferPatternReplacementsOptions?];
|
|
7
|
+
type MessageIds = "preferReplacement";
|
|
8
|
+
interface RuleDocsWithRecommended extends TSESLint.RuleMetaDataDocs {
|
|
9
|
+
readonly recommended: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const preferPatternReplacements: TSESLint.RuleModuleWithMetaDocs<MessageIds, Options, RuleDocsWithRecommended>;
|
|
12
|
+
export default preferPatternReplacements;
|
|
13
|
+
//# sourceMappingURL=prefer-pattern-replacements.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefer-pattern-replacements.d.ts","sourceRoot":"","sources":["../../src/rules/prefer-pattern-replacements.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGzD,OAAO,KAAK,EAAiB,OAAO,EAAgB,MAAM,kCAAkC,CAAC;AAY7F,UAAU,gCAAgC;IACzC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;CAC1C;AAED,KAAK,OAAO,GAAG,CAAC,gCAAgC,CAAC,CAAC,CAAC;AACnD,KAAK,UAAU,GAAG,mBAAmB,CAAC;AAEtC,UAAU,uBAAwB,SAAQ,QAAQ,CAAC,gBAAgB;IAClE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC9B;AAcD,QAAA,MAAM,yBAAyB,EAAE,QAAQ,CAAC,sBAAsB,CAAC,UAAU,EAAE,OAAO,EAAE,uBAAuB,CAsF5G,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TSESLint } from "@typescript-eslint/utils";
|
|
2
2
|
/**
|
|
3
3
|
* Configuration for a single opener/closer pair
|
|
4
4
|
*/
|
|
@@ -31,6 +31,22 @@ export interface RequirePairedCallsOptions {
|
|
|
31
31
|
/** Maximum nesting depth (0 = unlimited) */
|
|
32
32
|
readonly maxNestingDepth?: number;
|
|
33
33
|
}
|
|
34
|
-
declare const
|
|
34
|
+
declare const messages: {
|
|
35
|
+
readonly asyncViolation: "Cannot use {{asyncType}} between '{{opener}}' and '{{closer}}' (requireSync: true)";
|
|
36
|
+
readonly conditionalOpener: "Conditional opener '{{opener}}' at {{location}} may not have matching closer on all paths";
|
|
37
|
+
readonly maxNestingExceeded: "Maximum nesting depth of {{max}} exceeded for paired calls";
|
|
38
|
+
readonly multipleOpeners: "Multiple consecutive calls to '{{opener}}' without matching closers (allowMultipleOpeners: false)";
|
|
39
|
+
readonly robloxYieldViolation: "Yielding function '{{yieldingFunction}}' auto-closes all profiles - subsequent '{{closer}}' will error";
|
|
40
|
+
readonly unexpectedCloser: "Unexpected call to '{{closer}}' - expected one of: {{expected}}";
|
|
41
|
+
readonly unpairedCloser: "Unexpected call to '{{closer}}' - no matching opener on stack";
|
|
42
|
+
readonly unpairedOpener: "Unpaired call to '{{opener}}' - missing '{{closer}}' on {{paths}}";
|
|
43
|
+
readonly wrongOrder: "Closer '{{closer}}' called out of order - expected to close '{{expected}}' but '{{actual}}' is still open";
|
|
44
|
+
};
|
|
45
|
+
type MessageIds = keyof typeof messages;
|
|
46
|
+
type Options = [Partial<RequirePairedCallsOptions>?];
|
|
47
|
+
interface RuleDocsWithRecommended extends TSESLint.RuleMetaDataDocs {
|
|
48
|
+
recommended?: boolean;
|
|
49
|
+
}
|
|
50
|
+
declare const rule: TSESLint.RuleModuleWithMetaDocs<MessageIds, Options, RuleDocsWithRecommended>;
|
|
35
51
|
export default rule;
|
|
36
52
|
//# sourceMappingURL=require-paired-calls.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"require-paired-calls.d.ts","sourceRoot":"","sources":["../../src/rules/require-paired-calls.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"require-paired-calls.d.ts","sourceRoot":"","sources":["../../src/rules/require-paired-calls.ts"],"names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;AAED,QAAA,MAAM,IAAI,EAAE,QAAQ,CAAC,sBAAsB,CAAC,UAAU,EAAE,OAAO,EAAE,uBAAuB,CAi0BvF,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strict-component-boundaries.d.ts","sourceRoot":"","sources":["../../src/rules/strict-component-boundaries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAY,MAAM,0BAA0B,CAAC;AAInE,KAAK,UAAU,GAAG,yBAAyB,CAAC;AAE5C,UAAU,OAAO;IAChB,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACvC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC3B;AAmCD,QAAA,MAAM,yBAAyB,EAAE,QAAQ,CAAC,sBAAsB,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"strict-component-boundaries.d.ts","sourceRoot":"","sources":["../../src/rules/strict-component-boundaries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAY,MAAM,0BAA0B,CAAC;AAInE,KAAK,UAAU,GAAG,yBAAyB,CAAC;AAE5C,UAAU,OAAO;IAChB,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACvC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC3B;AAmCD,QAAA,MAAM,yBAAyB,EAAE,QAAQ,CAAC,sBAAsB,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,CAAC,CA8EtF,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-exhaustive-dependencies.d.ts","sourceRoot":"","sources":["../../src/rules/use-exhaustive-dependencies.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAS,MAAM,Q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AAC;AAEF,eAAe,yBAAyB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-hook-at-top-level.d.ts","sourceRoot":"","sources":["../../src/rules/use-hook-at-top-level.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAqBnC,MAAM,WAAW,wBAAwB;IACxC;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAE7C;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEjD;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC3C;
|
|
1
|
+
{"version":3,"file":"use-hook-at-top-level.d.ts","sourceRoot":"","sources":["../../src/rules/use-hook-at-top-level.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAqBnC,MAAM,WAAW,wBAAwB;IACxC;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAE7C;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEjD;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC3C;AA6GD,QAAA,MAAM,iBAAiB,EAAE,IAAI,CAAC,UAgT7B,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -9,6 +9,7 @@ import type { PairConfiguration, RequirePairedCallsOptions } from "../rules/requ
|
|
|
9
9
|
import type { ReactKeysOptions } from "../rules/require-react-component-keys";
|
|
10
10
|
import type { UseExhaustiveDependenciesOptions } from "../rules/use-exhaustive-dependencies";
|
|
11
11
|
import type { UseHookAtTopLevelOptions } from "../rules/use-hook-at-top-level";
|
|
12
|
+
import type { Pattern, PreferPatternReplacementsOptions } from "./pattern-replacement";
|
|
12
13
|
/**
|
|
13
14
|
* Creates a pair configuration for require-paired-calls rule
|
|
14
15
|
* @param opener - The opener function name
|
|
@@ -94,4 +95,10 @@ export declare function createUseHookAtTopLevelOptions(options?: Partial<UseHook
|
|
|
94
95
|
* @returns The full options
|
|
95
96
|
*/
|
|
96
97
|
export declare function createNoUselessUseSpringOptions(options?: Partial<NoUselessUseSpringOptions>): NoUselessUseSpringOptions;
|
|
98
|
+
/**
|
|
99
|
+
* Creates options for prefer-pattern-replacements rule
|
|
100
|
+
* @param patterns - Array of pattern configurations
|
|
101
|
+
* @returns The full options
|
|
102
|
+
*/
|
|
103
|
+
export declare function createPreferPatternReplacementsOptions(patterns?: ReadonlyArray<Pattern>): PreferPatternReplacementsOptions;
|
|
97
104
|
//# sourceMappingURL=configure-utilities.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configure-utilities.d.ts","sourceRoot":"","sources":["../../src/utilities/configure-utilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AAC1F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAEhF,OAAO,KAAK,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AACxG,OAAO,KAAK,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAClG,OAAO,KAAK,EAA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BAAwB,CAO1B;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC9C,OAAO,GAAE,OAAO,CAAC,yBAAyB,CAAM,GAC9C,yBAAyB,CAO3B;AAED;;;;GAIG;AACH,wBAAgB,sCAAsC,CACrD,QAAQ,GAAE,aAAa,CAAC,OAAO,CAAM,GACnC,gCAAgC,CAElC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { TSESTree } from "@typescript-eslint/types";
|
|
2
|
+
/**
|
|
3
|
+
* Normalize -0 to 0 for consistent comparisons
|
|
4
|
+
*
|
|
5
|
+
* @param num - The number to normalize
|
|
6
|
+
* @returns The normalized number (converts -0 to 0)
|
|
7
|
+
*/
|
|
8
|
+
export declare function normalizeZero(num: number): number;
|
|
9
|
+
/**
|
|
10
|
+
* Unwrap TypeScript wrapper nodes
|
|
11
|
+
*
|
|
12
|
+
* @param node - The expression node to unwrap
|
|
13
|
+
* @returns The unwrapped expression
|
|
14
|
+
*/
|
|
15
|
+
export declare function unwrap(node: TSESTree.Expression): TSESTree.Expression;
|
|
16
|
+
/**
|
|
17
|
+
* Evaluate a constant expression at lint time.
|
|
18
|
+
* Returns undefined if the expression cannot be evaluated to a constant.
|
|
19
|
+
*
|
|
20
|
+
* @param node - The expression node to evaluate
|
|
21
|
+
* @returns The evaluated constant number, or undefined if not a constant
|
|
22
|
+
*/
|
|
23
|
+
export declare function evaluateConstant(node: TSESTree.Expression): number | undefined;
|
|
24
|
+
//# sourceMappingURL=constant-folder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constant-folder.d.ts","sourceRoot":"","sources":["../../../src/utilities/pattern-replacement/constant-folder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGzD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,UAAU,GAAG,QAAQ,CAAC,UAAU,CASrE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,UAAU,GAAG,MAAM,GAAG,SAAS,CAwD9E"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { PatternIndex } from "./pattern-matcher";
|
|
2
|
+
export { buildPatternIndex, canSafelySubstitute, evaluateConditions, matchParameters, resolveCallee, } from "./pattern-matcher";
|
|
3
|
+
export { parsePattern } from "./pattern-parser";
|
|
4
|
+
export type { ParsedPattern, Pattern, PreferPatternReplacementsOptions } from "./pattern-types";
|
|
5
|
+
export { pattern } from "./pattern-types";
|
|
6
|
+
export { generateReplacement, getReplacementIdentifier } from "./replacement-generator";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/pattern-replacement/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EACN,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,aAAa,GACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,gCAAgC,EAAE,MAAM,iBAAiB,CAAC;AAEhG,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { TSESTree } from "@typescript-eslint/types";
|
|
2
|
+
import type { SourceCode } from "@typescript-eslint/utils/ts-eslint";
|
|
3
|
+
import type { CapturedValue, ParsedParameter, ParsedPattern, WhenCondition } from "./pattern-types";
|
|
4
|
+
export type PatternIndex = ReadonlyMap<string, ReadonlyArray<ParsedPattern>>;
|
|
5
|
+
type ResolvedCallee = {
|
|
6
|
+
readonly kind: "constructor";
|
|
7
|
+
readonly typeName: string;
|
|
8
|
+
} | {
|
|
9
|
+
readonly kind: "staticMethod";
|
|
10
|
+
readonly typeName: string;
|
|
11
|
+
readonly methodName: string;
|
|
12
|
+
} | {
|
|
13
|
+
readonly kind: "unknown";
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Build an index for O(1) pattern lookup
|
|
17
|
+
*
|
|
18
|
+
* @param patterns - Array of parsed patterns to index
|
|
19
|
+
* @returns Map of pattern index keys to pattern arrays
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildPatternIndex(patterns: ReadonlyArray<ParsedPattern>): PatternIndex;
|
|
22
|
+
/**
|
|
23
|
+
* Resolve the callee of a call/new expression
|
|
24
|
+
*
|
|
25
|
+
* @param node - Call or new expression node
|
|
26
|
+
* @returns Resolved callee information
|
|
27
|
+
*/
|
|
28
|
+
export declare function resolveCallee(node: TSESTree.CallExpression | TSESTree.NewExpression): ResolvedCallee;
|
|
29
|
+
/**
|
|
30
|
+
* Capture an argument value for matching
|
|
31
|
+
*
|
|
32
|
+
* @param node - Expression node to capture
|
|
33
|
+
* @param sourceCode - ESLint source code object
|
|
34
|
+
* @returns Captured value with metadata
|
|
35
|
+
*/
|
|
36
|
+
export declare function captureParameter(node: TSESTree.Expression, sourceCode: SourceCode): CapturedValue;
|
|
37
|
+
/**
|
|
38
|
+
* Match arguments against a pattern
|
|
39
|
+
*
|
|
40
|
+
* @param patterns - Pattern arguments to match against
|
|
41
|
+
* @param parameters - Actual expression arguments
|
|
42
|
+
* @param sourceCode - ESLint source code object
|
|
43
|
+
* @returns Map of captures if match succeeds, undefined otherwise
|
|
44
|
+
*/
|
|
45
|
+
export declare function matchParameters(patterns: ReadonlyArray<ParsedParameter>, parameters: ReadonlyArray<TSESTree.Expression>, sourceCode: SourceCode): Map<string, CapturedValue> | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Evaluate when conditions against captured values
|
|
48
|
+
*
|
|
49
|
+
* @param conditions - Map of variable names to conditions
|
|
50
|
+
* @param captures - Map of captured values
|
|
51
|
+
* @returns True if all conditions pass
|
|
52
|
+
*/
|
|
53
|
+
export declare function evaluateConditions(conditions: ReadonlyMap<string, WhenCondition>, captures: ReadonlyMap<string, CapturedValue>): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Check if captures can be safely substituted
|
|
56
|
+
*
|
|
57
|
+
* @param captures - Map of captured values
|
|
58
|
+
* @returns True if all captures are simple (not complex expressions)
|
|
59
|
+
*/
|
|
60
|
+
export declare function canSafelySubstitute(captures: ReadonlyMap<string, CapturedValue>): boolean;
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=pattern-matcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pattern-matcher.d.ts","sourceRoot":"","sources":["../../../src/utilities/pattern-replacement/pattern-matcher.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAGrE,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEpG,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC;AAE7E,KAAK,cAAc,GAChB;IAAE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC3D;IAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACzF;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC;AAEhC;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,aAAa,CAAC,aAAa,CAAC,GAAG,YAAY,CAetF;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,CAAC,cAAc,GAAG,QAAQ,CAAC,aAAa,GAAG,cAAc,CAuBpG;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,GAAG,aAAa,CAqBjG;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC9B,QAAQ,EAAE,aAAa,CAAC,eAAe,CAAC,EACxC,UAAU,EAAE,aAAa,CAAC,QAAQ,CAAC,UAAU,CAAC,EAC9C,UAAU,EAAE,UAAU,GACpB,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,SAAS,CAqCxC;AASD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CACjC,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,EAC9C,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,GAC1C,OAAO,CA2CT;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,OAAO,CAGzF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ParsedParameter, ParsedPattern, ParsedReplacement, WhenCondition } from "./pattern-types";
|
|
2
|
+
/**
|
|
3
|
+
* Parse argument string into ParsedArg array
|
|
4
|
+
* @param parametersString - Comma-separated argument string
|
|
5
|
+
* @returns Array of parsed arguments
|
|
6
|
+
*/
|
|
7
|
+
export declare function parseParameters(parametersString: string): ReadonlyArray<ParsedParameter>;
|
|
8
|
+
/**
|
|
9
|
+
* Parse replacement string into ParsedReplacement
|
|
10
|
+
* @param replacement - Replacement expression string
|
|
11
|
+
* @returns Parsed replacement structure
|
|
12
|
+
*/
|
|
13
|
+
export declare function parseReplacement(replacement: string): ParsedReplacement;
|
|
14
|
+
/**
|
|
15
|
+
* Parse a pattern string into ParsedPattern
|
|
16
|
+
* @param match - Pattern match expression
|
|
17
|
+
* @param replacement - Replacement expression
|
|
18
|
+
* @param when - Optional conditions for captures
|
|
19
|
+
* @returns Parsed pattern structure
|
|
20
|
+
*/
|
|
21
|
+
export declare function parsePattern(match: string, replacement: string, when: Record<string, WhenCondition> | undefined): ParsedPattern;
|
|
22
|
+
//# sourceMappingURL=pattern-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pattern-parser.d.ts","sourceRoot":"","sources":["../../../src/utilities/pattern-replacement/pattern-parser.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAOxG;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,gBAAgB,EAAE,MAAM,GAAG,aAAa,CAAC,eAAe,CAAC,CAqBxF;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,iBAAiB,CAYvE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC3B,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,SAAS,GAC7C,aAAa,CAiCf"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { TSESTree } from "@typescript-eslint/types";
|
|
2
|
+
declare const PatternBrand: unique symbol;
|
|
3
|
+
type ExtractVariableName<VariableString extends string> = VariableString extends `${infer Name},${infer Rest}` ? [Name, `,${Rest}`] : VariableString extends `${infer Name})${infer Rest}` ? [Name, `)${Rest}`] : VariableString extends `${infer Name} ${infer Rest}` ? [Name, ` ${Rest}`] : VariableString extends `${infer Name}?${infer Rest}` ? [Name, `?${Rest}`] : [VariableString, ""];
|
|
4
|
+
type ExtractCaptures<VariableString extends string> = VariableString extends `${string}$${infer Rest}` ? ExtractVariableName<Rest> extends [infer Name extends string, infer Remainder extends string] ? Name | ExtractCaptures<Remainder> : never : never;
|
|
5
|
+
interface TypeError<Message extends string> {
|
|
6
|
+
readonly __typeError__: Message;
|
|
7
|
+
}
|
|
8
|
+
export type WhenCondition = `!= ${string}` | `== ${string}` | `> ${string}` | `< ${string}` | `>= ${string}` | `<= ${string}`;
|
|
9
|
+
type ValidateWhenClause<Match extends string, When> = {
|
|
10
|
+
readonly [Key in keyof When]: Key extends ExtractCaptures<Match> ? WhenCondition : TypeError<`'${Key & string}' is not a capture variable. Valid captures: ${ExtractCaptures<Match> extends never ? "(none)" : ExtractCaptures<Match>}`>;
|
|
11
|
+
};
|
|
12
|
+
export interface Pattern<Match extends string = string> {
|
|
13
|
+
readonly [PatternBrand]: Match;
|
|
14
|
+
readonly match: Match;
|
|
15
|
+
readonly replacement: string;
|
|
16
|
+
readonly when?: {
|
|
17
|
+
readonly [Key in ExtractCaptures<Match>]?: WhenCondition;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export declare function pattern<const Match extends string, const WhenClause extends object = object>(configuration: {
|
|
21
|
+
readonly match: Match;
|
|
22
|
+
readonly replacement: string;
|
|
23
|
+
readonly when?: WhenClause & ValidateWhenClause<Match, WhenClause>;
|
|
24
|
+
}): Pattern<Match>;
|
|
25
|
+
export interface PreferPatternReplacementsOptions {
|
|
26
|
+
readonly patterns: ReadonlyArray<Pattern>;
|
|
27
|
+
}
|
|
28
|
+
export type ParsedParameter = {
|
|
29
|
+
readonly kind: "literal";
|
|
30
|
+
readonly value: number;
|
|
31
|
+
} | {
|
|
32
|
+
readonly kind: "optional";
|
|
33
|
+
readonly value: number;
|
|
34
|
+
} | {
|
|
35
|
+
readonly kind: "capture";
|
|
36
|
+
readonly name: string;
|
|
37
|
+
} | {
|
|
38
|
+
readonly kind: "wildcard";
|
|
39
|
+
};
|
|
40
|
+
export type ParsedReplacement = {
|
|
41
|
+
readonly kind: "identifier";
|
|
42
|
+
readonly name: string;
|
|
43
|
+
} | {
|
|
44
|
+
readonly kind: "staticAccess";
|
|
45
|
+
readonly typeName: string;
|
|
46
|
+
readonly property: string;
|
|
47
|
+
} | {
|
|
48
|
+
readonly kind: "call";
|
|
49
|
+
readonly name: string;
|
|
50
|
+
readonly parameters: ReadonlyArray<string>;
|
|
51
|
+
};
|
|
52
|
+
export interface ParsedPattern {
|
|
53
|
+
readonly conditions: ReadonlyMap<string, WhenCondition>;
|
|
54
|
+
readonly methodName?: string;
|
|
55
|
+
readonly original: string;
|
|
56
|
+
readonly parameters: ReadonlyArray<ParsedParameter>;
|
|
57
|
+
readonly replacement: ParsedReplacement;
|
|
58
|
+
readonly type: "constructor" | "staticMethod";
|
|
59
|
+
readonly typeName: string;
|
|
60
|
+
}
|
|
61
|
+
export interface CapturedValue {
|
|
62
|
+
readonly constValue?: number;
|
|
63
|
+
readonly expressionKey: string;
|
|
64
|
+
readonly isComplex: boolean;
|
|
65
|
+
readonly node: TSESTree.Expression;
|
|
66
|
+
readonly sourceText: string;
|
|
67
|
+
}
|
|
68
|
+
export {};
|
|
69
|
+
//# sourceMappingURL=pattern-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pattern-types.d.ts","sourceRoot":"","sources":["../../../src/utilities/pattern-replacement/pattern-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGzD,OAAO,CAAC,MAAM,YAAY,EAAE,OAAO,MAAM,CAAC;AAG1C,KAAK,mBAAmB,CAAC,cAAc,SAAS,MAAM,IAAI,cAAc,SAAS,GAAG,MAAM,IAAI,IAAI,MAAM,IAAI,EAAE,GAC3G,CAAC,IAAI,EAAE,IAAI,IAAI,EAAE,CA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C;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACtD;IAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACvF;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC;AAGhG,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACxD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IACpD,QAAQ,CAAC,WAAW,EAAE,iBAAiB,CAAC;IACxC,QAAQ,CAAC,IAAI,EAAE,aAAa,GAAG,cAAc,CAAC;IAC9C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC1B;AAGD,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC;IACnC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC5B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CapturedValue, ParsedReplacement } from "./pattern-types";
|
|
2
|
+
/**
|
|
3
|
+
* Get the identifier name from a replacement (for scope conflict checking)
|
|
4
|
+
* Returns undefined for static access (no local conflict possible)
|
|
5
|
+
* @param replacement - The parsed replacement to extract identifier from
|
|
6
|
+
* @returns The identifier name or undefined for static access
|
|
7
|
+
*/
|
|
8
|
+
export declare function getReplacementIdentifier(replacement: ParsedReplacement): string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Generate replacement text from a parsed replacement and captured values
|
|
11
|
+
* @param replacement - The parsed replacement pattern
|
|
12
|
+
* @param captures - Map of captured values from pattern matching
|
|
13
|
+
* @returns The generated replacement text
|
|
14
|
+
*/
|
|
15
|
+
export declare function generateReplacement(replacement: ParsedReplacement, captures: ReadonlyMap<string, CapturedValue>): string;
|
|
16
|
+
//# sourceMappingURL=replacement-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replacement-generator.d.ts","sourceRoot":"","sources":["../../../src/utilities/pattern-replacement/replacement-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAExE;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,iBAAiB,GAAG,MAAM,GAAG,SAAS,CAW3F;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAClC,WAAW,EAAE,iBAAiB,EAC9B,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,GAC1C,MAAM,CA0BR"}
|
package/package.json
CHANGED