@flint.fyi/plugin-flint 0.5.1 → 0.6.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/lib/index.d.ts +14 -17
- package/lib/index.js +28 -22
- package/lib/plugin.d.ts +0 -1
- package/lib/rules/getStartSourceFile.d.ts +0 -1
- package/lib/rules/invalidCodeLines.d.ts +0 -1
- package/lib/rules/missingPlaceholders.d.ts +0 -1
- package/lib/rules/nodePropertyInChecks.d.ts +0 -1
- package/lib/rules/placeholderFormats.d.ts +0 -1
- package/lib/rules/pluginRuleOrdering.d.ts +0 -1
- package/lib/rules/ruleCreationMethods.d.ts +0 -1
- package/lib/rules/ruleCreator.d.ts +0 -1
- package/lib/rules/testCaseDuplicates.d.ts +0 -1
- package/lib/rules/testCaseNameDuplicates.d.ts +0 -1
- package/lib/rules/testCaseNonStaticCode.d.ts +0 -1
- package/lib/rules/testCaseOnlyFlags.d.ts +0 -1
- package/lib/rules/testShorthands.d.ts +0 -1
- package/lib/rules/unusedMessageIds.d.ts +0 -1
- package/lib/utils/findProperty.d.ts +1 -2
- package/lib/utils/getRuleTesterCaseArrays.d.ts +0 -1
- package/lib/utils/getRuleTesterDescribedCases.d.ts +35 -2
- package/lib/utils/importHelpers.d.ts +1 -2
- package/lib/utils/isTypeFromTS.d.ts +0 -1
- package/lib/utils/messageHelpers.d.ts +0 -1
- package/lib/utils/parseTestCases.d.ts +37 -4
- package/lib/utils/ruleCreatorHelpers.d.ts +0 -1
- package/lib/utils/tsAstToLiteral.d.ts +1 -2
- package/lib/utils/types.d.ts +9 -6
- package/package.json +8 -9
package/lib/index.d.ts
CHANGED
|
@@ -1,91 +1,89 @@
|
|
|
1
|
-
import * as _flint_fyi_core0 from "@flint.fyi/core";
|
|
2
|
-
|
|
3
1
|
//#region src/plugin.d.ts
|
|
4
|
-
declare const flint:
|
|
2
|
+
declare const flint: import("@flint.fyi/core").Plugin<import("@flint.fyi/core").RuleAbout<string>, string | undefined, [import("@flint.fyi/core").Rule<{
|
|
5
3
|
readonly description: "Requires passing `sourceFile` to `getStart()` for better performance.";
|
|
6
4
|
readonly id: "getStartSourceFile";
|
|
7
5
|
readonly presets: readonly ["logical"];
|
|
8
6
|
} & {
|
|
9
7
|
readonly pluginId: string;
|
|
10
8
|
readonly url: string;
|
|
11
|
-
}, "missingSourceFile", undefined>,
|
|
9
|
+
}, "missingSourceFile", undefined>, import("@flint.fyi/core").Rule<{
|
|
12
10
|
readonly description: "Reports cases for invalid code that isn't formatted across lines.";
|
|
13
11
|
readonly id: "invalidCodeLines";
|
|
14
12
|
readonly presets: readonly ["logical"];
|
|
15
13
|
} & {
|
|
16
14
|
readonly pluginId: string;
|
|
17
15
|
readonly url: string;
|
|
18
|
-
}, "singleLineTest", undefined>,
|
|
16
|
+
}, "singleLineTest", undefined>, import("@flint.fyi/core").Rule<{
|
|
19
17
|
readonly description: "Reports `context.report()` calls missing data for message placeholders.";
|
|
20
18
|
readonly id: "missingPlaceholders";
|
|
21
19
|
readonly presets: readonly ["logical"];
|
|
22
20
|
} & {
|
|
23
21
|
readonly pluginId: string;
|
|
24
22
|
readonly url: string;
|
|
25
|
-
}, "missingPlaceholders", undefined>,
|
|
23
|
+
}, "missingPlaceholders", undefined>, import("@flint.fyi/core").Rule<{
|
|
26
24
|
readonly description: "Disallows using the `in` operator to check properties on TypeScript nodes.";
|
|
27
25
|
readonly id: "nodePropertyInChecks";
|
|
28
26
|
readonly presets: readonly ["logical"];
|
|
29
27
|
} & {
|
|
30
28
|
readonly pluginId: string;
|
|
31
29
|
readonly url: string;
|
|
32
|
-
}, "nodePropertyInChecks", undefined>,
|
|
30
|
+
}, "nodePropertyInChecks", undefined>, import("@flint.fyi/core").Rule<{
|
|
33
31
|
readonly description: "Reports and auto-fixes message placeholders that are not formatted as `{{ placeholder }}`.";
|
|
34
32
|
readonly id: "placeholderFormats";
|
|
35
33
|
readonly presets: readonly ["stylistic", "stylisticStrict"];
|
|
36
34
|
} & {
|
|
37
35
|
readonly pluginId: string;
|
|
38
36
|
readonly url: string;
|
|
39
|
-
}, "placeholderFormats", undefined>,
|
|
37
|
+
}, "placeholderFormats", undefined>, import("@flint.fyi/core").Rule<{
|
|
40
38
|
readonly description: "Reports Flint plugin `rules` arrays that are not sorted alphabetically.";
|
|
41
39
|
readonly id: "pluginRuleOrdering";
|
|
42
40
|
readonly presets: readonly ["stylisticStrict"];
|
|
43
41
|
} & {
|
|
44
42
|
readonly pluginId: string;
|
|
45
43
|
readonly url: string;
|
|
46
|
-
}, "pluginRuleOrdering", undefined>,
|
|
44
|
+
}, "pluginRuleOrdering", undefined>, import("@flint.fyi/core").Rule<{
|
|
47
45
|
readonly description: "Reports plugin rules created directly with language instead of through RuleCreator.";
|
|
48
46
|
readonly id: "ruleCreationMethods";
|
|
49
47
|
readonly presets: readonly ["logical"];
|
|
50
48
|
} & {
|
|
51
49
|
readonly pluginId: string;
|
|
52
50
|
readonly url: string;
|
|
53
|
-
}, "ruleCreationMethods", undefined>,
|
|
51
|
+
}, "ruleCreationMethods", undefined>, import("@flint.fyi/core").Rule<{
|
|
54
52
|
readonly description: "Reports test cases that are identical to previous test cases.";
|
|
55
53
|
readonly id: "testCaseDuplicates";
|
|
56
54
|
readonly presets: readonly ["logical"];
|
|
57
55
|
} & {
|
|
58
56
|
readonly pluginId: string;
|
|
59
57
|
readonly url: string;
|
|
60
|
-
}, "duplicateTest", undefined>,
|
|
58
|
+
}, "duplicateTest", undefined>, import("@flint.fyi/core").Rule<{
|
|
61
59
|
readonly description: "Reports test cases that have the same name as a previous test case.";
|
|
62
60
|
readonly id: "testCaseNameDuplicates";
|
|
63
61
|
readonly presets: readonly ["logical"];
|
|
64
62
|
} & {
|
|
65
63
|
readonly pluginId: string;
|
|
66
64
|
readonly url: string;
|
|
67
|
-
}, "duplicateTestName", undefined>,
|
|
65
|
+
}, "duplicateTestName", undefined>, import("@flint.fyi/core").Rule<{
|
|
68
66
|
readonly description: "Test case code should be a static string literal.";
|
|
69
67
|
readonly id: "testCaseNonStaticCode";
|
|
70
68
|
readonly presets: readonly ["logical"];
|
|
71
69
|
} & {
|
|
72
70
|
readonly pluginId: string;
|
|
73
71
|
readonly url: string;
|
|
74
|
-
}, "nonStaticTestCaseCode", undefined>,
|
|
72
|
+
}, "nonStaticTestCaseCode", undefined>, import("@flint.fyi/core").Rule<{
|
|
75
73
|
readonly description: "Reports test cases that are marked `only: true`.";
|
|
76
74
|
readonly id: "testCaseOnlyFlags";
|
|
77
75
|
readonly presets: readonly ["logical"];
|
|
78
76
|
} & {
|
|
79
77
|
readonly pluginId: string;
|
|
80
78
|
readonly url: string;
|
|
81
|
-
}, "testCaseOnly", undefined>,
|
|
79
|
+
}, "testCaseOnly", undefined>, import("@flint.fyi/core").Rule<{
|
|
82
80
|
readonly description: "Test cases with only a code property can use string shorthand syntax instead of object literal syntax.";
|
|
83
81
|
readonly id: "testShorthands";
|
|
84
82
|
readonly presets: readonly ["logical"];
|
|
85
83
|
} & {
|
|
86
84
|
readonly pluginId: string;
|
|
87
85
|
readonly url: string;
|
|
88
|
-
}, "testShorthands", undefined>,
|
|
86
|
+
}, "testShorthands", undefined>, import("@flint.fyi/core").Rule<{
|
|
89
87
|
readonly description: "Reports message IDs defined in the messages object that are never used in recognized report calls.";
|
|
90
88
|
readonly id: "unusedMessageIds";
|
|
91
89
|
readonly presets: readonly ["logical"];
|
|
@@ -94,5 +92,4 @@ declare const flint: _flint_fyi_core0.Plugin<_flint_fyi_core0.RuleAbout<string>,
|
|
|
94
92
|
readonly url: string;
|
|
95
93
|
}, "unusedMessageIds", undefined>]>;
|
|
96
94
|
//#endregion
|
|
97
|
-
export { flint };
|
|
98
|
-
//# sourceMappingURL=index.d.ts.map
|
|
95
|
+
export { flint };
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RuleCreator, createPlugin } from "@flint.fyi/core";
|
|
2
|
-
import { getTSNodeRange, typescriptLanguage } from "@flint.fyi/typescript-language";
|
|
3
2
|
import ts, { SyntaxKind } from "typescript";
|
|
3
|
+
import { getTSNodeRange, isStaticString, isStringRawNoSubstitution, typescriptLanguage } from "@flint.fyi/typescript-language";
|
|
4
4
|
import { isTruthy } from "@flint.fyi/utils";
|
|
5
5
|
//#region src/utils/isTypeFromTS.ts
|
|
6
6
|
function isTypeFromTS(node, typeChecker, typeName) {
|
|
@@ -95,22 +95,22 @@ function tsAstToLiteral(node) {
|
|
|
95
95
|
//#endregion
|
|
96
96
|
//#region src/utils/parseTestCases.ts
|
|
97
97
|
function parseTestCase(node) {
|
|
98
|
-
if (node
|
|
99
|
-
code: node
|
|
98
|
+
if (isTestCaseCode(node)) return {
|
|
99
|
+
code: getTestCaseCode(node),
|
|
100
100
|
nodes: {
|
|
101
101
|
case: node,
|
|
102
102
|
code: node
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
105
|
if (node.kind !== SyntaxKind.ObjectLiteralExpression) return;
|
|
106
|
-
const code = findProperty(node.properties, "code",
|
|
106
|
+
const code = findProperty(node.properties, "code", isTestCaseCode);
|
|
107
107
|
if (!code) return;
|
|
108
|
-
const fileName = findProperty(node.properties, "fileName",
|
|
108
|
+
const fileName = findProperty(node.properties, "fileName", isStaticString);
|
|
109
109
|
const files = findProperty(node.properties, "files", (node) => node.kind === SyntaxKind.ObjectLiteralExpression);
|
|
110
|
-
const name = findProperty(node.properties, "name",
|
|
110
|
+
const name = findProperty(node.properties, "name", isStaticString);
|
|
111
111
|
const options = findProperty(node.properties, "options", (node) => node.kind === SyntaxKind.ObjectLiteralExpression);
|
|
112
112
|
return {
|
|
113
|
-
code: code
|
|
113
|
+
code: getTestCaseCode(code),
|
|
114
114
|
fileName: fileName?.text,
|
|
115
115
|
files: files && tsAstToLiteral(files),
|
|
116
116
|
name: name?.text,
|
|
@@ -127,16 +127,16 @@ function parseTestCase(node) {
|
|
|
127
127
|
}
|
|
128
128
|
function parseTestCaseInvalid(node) {
|
|
129
129
|
if (node.kind !== SyntaxKind.ObjectLiteralExpression) return;
|
|
130
|
-
const code = findProperty(node.properties, "code",
|
|
130
|
+
const code = findProperty(node.properties, "code", isTestCaseCode);
|
|
131
131
|
if (!code) return;
|
|
132
|
-
const fileName = findProperty(node.properties, "fileName",
|
|
132
|
+
const fileName = findProperty(node.properties, "fileName", isStaticString);
|
|
133
133
|
const files = findProperty(node.properties, "files", (node) => node.kind === SyntaxKind.ObjectLiteralExpression);
|
|
134
|
-
const name = findProperty(node.properties, "name",
|
|
134
|
+
const name = findProperty(node.properties, "name", isStaticString);
|
|
135
135
|
const options = findProperty(node.properties, "options", (node) => node.kind === SyntaxKind.ObjectLiteralExpression);
|
|
136
|
-
const snapshot = findProperty(node.properties, "snapshot",
|
|
136
|
+
const snapshot = findProperty(node.properties, "snapshot", isStaticString);
|
|
137
137
|
if (!snapshot) return;
|
|
138
138
|
return {
|
|
139
|
-
code: code
|
|
139
|
+
code: getTestCaseCode(code),
|
|
140
140
|
fileName: fileName?.text,
|
|
141
141
|
files: files && tsAstToLiteral(files),
|
|
142
142
|
name: name?.text,
|
|
@@ -153,6 +153,13 @@ function parseTestCaseInvalid(node) {
|
|
|
153
153
|
snapshot: snapshot.text
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
|
+
function getTestCaseCode(node) {
|
|
157
|
+
if (isStringRawNoSubstitution(node)) return node.template.rawText ?? node.template.text;
|
|
158
|
+
return node.text;
|
|
159
|
+
}
|
|
160
|
+
function isTestCaseCode(node) {
|
|
161
|
+
return isStaticString(node) || isStringRawNoSubstitution(node);
|
|
162
|
+
}
|
|
156
163
|
//#endregion
|
|
157
164
|
//#region src/utils/getRuleTesterDescribedCases.ts
|
|
158
165
|
function getRuleTesterDescribedCases(node) {
|
|
@@ -190,18 +197,19 @@ var invalidCodeLines_default = ruleCreator.createRule(typescriptLanguage, {
|
|
|
190
197
|
range: getTSNodeRange(node, sourceFile),
|
|
191
198
|
text: `\`\n${code}\n\``
|
|
192
199
|
}];
|
|
200
|
+
const template = node.kind === ts.SyntaxKind.TaggedTemplateExpression ? node.template : node;
|
|
193
201
|
const changes = [];
|
|
194
202
|
if (!code.startsWith("\n")) changes.push({
|
|
195
203
|
range: {
|
|
196
|
-
begin:
|
|
197
|
-
end:
|
|
204
|
+
begin: template.getStart(sourceFile) + 1,
|
|
205
|
+
end: template.getStart(sourceFile) + 1
|
|
198
206
|
},
|
|
199
207
|
text: "\n"
|
|
200
208
|
});
|
|
201
209
|
if (!code.endsWith("\n")) changes.push({
|
|
202
210
|
range: {
|
|
203
|
-
begin:
|
|
204
|
-
end:
|
|
211
|
+
begin: template.getEnd() - 1,
|
|
212
|
+
end: template.getEnd() - 1
|
|
205
213
|
},
|
|
206
214
|
text: "\n"
|
|
207
215
|
});
|
|
@@ -593,10 +601,10 @@ function getCodeProperty(node) {
|
|
|
593
601
|
return property.kind === SyntaxKind.ShorthandPropertyAssignment && property.name.text === "code";
|
|
594
602
|
});
|
|
595
603
|
}
|
|
596
|
-
function isStaticString(node) {
|
|
604
|
+
function isStaticString$1(node) {
|
|
597
605
|
return node.kind === SyntaxKind.StringLiteral || node.kind === SyntaxKind.NoSubstitutionTemplateLiteral;
|
|
598
606
|
}
|
|
599
|
-
function isStringRawNoSubstitution(node) {
|
|
607
|
+
function isStringRawNoSubstitution$1(node) {
|
|
600
608
|
if (node.kind !== SyntaxKind.TaggedTemplateExpression) return false;
|
|
601
609
|
const tag = node.tag;
|
|
602
610
|
return tag.kind === SyntaxKind.PropertyAccessExpression && tag.expression.kind === SyntaxKind.Identifier && tag.expression.text === "String" && tag.name.kind === SyntaxKind.Identifier && tag.name.text === "raw" && node.template.kind === SyntaxKind.NoSubstitutionTemplateLiteral;
|
|
@@ -614,7 +622,7 @@ var testCaseNonStaticCode_default = ruleCreator.createRule(typescriptLanguage, {
|
|
|
614
622
|
} },
|
|
615
623
|
setup(context) {
|
|
616
624
|
function checkTestCase(testCase, sourceFile) {
|
|
617
|
-
if (testCase.kind === SyntaxKind.OmittedExpression || isStaticString(testCase) || isStringRawNoSubstitution(testCase)) return;
|
|
625
|
+
if (testCase.kind === SyntaxKind.OmittedExpression || isStaticString$1(testCase) || isStringRawNoSubstitution$1(testCase)) return;
|
|
618
626
|
if (testCase.kind !== SyntaxKind.ObjectLiteralExpression) {
|
|
619
627
|
const range = getTSNodeRange(testCase, sourceFile);
|
|
620
628
|
context.report({
|
|
@@ -635,7 +643,7 @@ var testCaseNonStaticCode_default = ruleCreator.createRule(typescriptLanguage, {
|
|
|
635
643
|
return;
|
|
636
644
|
}
|
|
637
645
|
if (codeProperty.kind === SyntaxKind.PropertyAssignment) {
|
|
638
|
-
if (isStaticString(codeProperty.initializer) || isStringRawNoSubstitution(codeProperty.initializer)) return;
|
|
646
|
+
if (isStaticString$1(codeProperty.initializer) || isStringRawNoSubstitution$1(codeProperty.initializer)) return;
|
|
639
647
|
const range = getTSNodeRange(codeProperty.initializer, sourceFile);
|
|
640
648
|
context.report({
|
|
641
649
|
message: "nonStaticTestCaseCode",
|
|
@@ -833,5 +841,3 @@ const flint = createPlugin({
|
|
|
833
841
|
});
|
|
834
842
|
//#endregion
|
|
835
843
|
export { flint };
|
|
836
|
-
|
|
837
|
-
//# sourceMappingURL=index.js.map
|
package/lib/plugin.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { RuleCreator } from "@flint.fyi/core";
|
|
2
2
|
export declare const ruleCreator: RuleCreator<"logical" | "logicalStrict" | "stylistic" | "stylisticStrict", import("@flint.fyi/core").RuleAbout<"logical" | "logicalStrict" | "stylistic" | "stylisticStrict">>;
|
|
3
|
-
//# sourceMappingURL=ruleCreator.d.ts.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { AST } from "@flint.fyi/typescript-language";
|
|
2
1
|
import type ts from "typescript";
|
|
2
|
+
import type { AST } from "@flint.fyi/typescript-language";
|
|
3
3
|
export declare function findProperty<Node extends AST.Expression>(properties: ts.NodeArray<AST.ObjectLiteralElementLike>, name: string, predicate: (node: AST.Expression) => node is Node): (AST.Expression & Node) | undefined;
|
|
4
|
-
//# sourceMappingURL=findProperty.d.ts.map
|
|
@@ -1,6 +1,39 @@
|
|
|
1
1
|
import type { AST } from "@flint.fyi/typescript-language";
|
|
2
2
|
export declare function getRuleTesterDescribedCases(node: AST.CallExpression): {
|
|
3
3
|
invalid: import("./types.ts").ParsedTestCaseInvalid[];
|
|
4
|
-
valid:
|
|
4
|
+
valid: ({
|
|
5
|
+
code: string;
|
|
6
|
+
nodes: {
|
|
7
|
+
case: AST.NoSubstitutionTemplateLiteral | AST.StringLiteral | (AST.TaggedTemplateExpression & {
|
|
8
|
+
template: AST.NoSubstitutionTemplateLiteral;
|
|
9
|
+
});
|
|
10
|
+
code: AST.NoSubstitutionTemplateLiteral | AST.StringLiteral | (AST.TaggedTemplateExpression & {
|
|
11
|
+
template: AST.NoSubstitutionTemplateLiteral;
|
|
12
|
+
});
|
|
13
|
+
fileName?: never;
|
|
14
|
+
files?: never;
|
|
15
|
+
name?: never;
|
|
16
|
+
options?: never;
|
|
17
|
+
};
|
|
18
|
+
fileName?: never;
|
|
19
|
+
files?: never;
|
|
20
|
+
name?: never;
|
|
21
|
+
options?: never;
|
|
22
|
+
} | {
|
|
23
|
+
code: string;
|
|
24
|
+
fileName: string | undefined;
|
|
25
|
+
files: Record<string, string> | undefined;
|
|
26
|
+
name: string | undefined;
|
|
27
|
+
nodes: {
|
|
28
|
+
case: AST.ObjectLiteralExpression;
|
|
29
|
+
code: AST.NoSubstitutionTemplateLiteral | AST.StringLiteral | (AST.TaggedTemplateExpression & {
|
|
30
|
+
template: AST.NoSubstitutionTemplateLiteral;
|
|
31
|
+
});
|
|
32
|
+
fileName: AST.NoSubstitutionTemplateLiteral | AST.StringLiteral | undefined;
|
|
33
|
+
files: AST.ObjectLiteralExpression | undefined;
|
|
34
|
+
name: AST.NoSubstitutionTemplateLiteral | AST.StringLiteral | undefined;
|
|
35
|
+
options: AST.ObjectLiteralExpression | undefined;
|
|
36
|
+
};
|
|
37
|
+
options: object | undefined;
|
|
38
|
+
})[];
|
|
5
39
|
} | undefined;
|
|
6
|
-
//# sourceMappingURL=getRuleTesterDescribedCases.d.ts.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { AST } from "@flint.fyi/typescript-language";
|
|
2
1
|
import { type Node } from "typescript";
|
|
2
|
+
import type { AST } from "@flint.fyi/typescript-language";
|
|
3
3
|
export declare function isImportedBindingFromModule(declaration: Node, moduleName: string): declaration is AST.ImportSpecifier | AST.NamespaceImport;
|
|
4
4
|
export declare function isImportedSpecifierFromModule(declaration: Node, moduleName: string, importedName: string): declaration is AST.ImportSpecifier;
|
|
5
|
-
//# sourceMappingURL=importHelpers.d.ts.map
|
|
@@ -9,4 +9,3 @@ export declare function findMessagesProperty(node: AST.CallExpression): AST.Prop
|
|
|
9
9
|
export declare function forEachMessageString(messagesProperty: AST.PropertyAssignment): Generator<MessageStringVisitorContext>;
|
|
10
10
|
export declare function getStringOriginalQuote(node: AST.StringLiteral, sourceFile: AST.SourceFile): string;
|
|
11
11
|
export {};
|
|
12
|
-
//# sourceMappingURL=messageHelpers.d.ts.map
|
|
@@ -1,5 +1,38 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type {
|
|
3
|
-
export declare function parseTestCase(node: AST.Expression):
|
|
1
|
+
import { type AST } from "@flint.fyi/typescript-language";
|
|
2
|
+
import type { ParsedTestCaseInvalid } from "./types.ts";
|
|
3
|
+
export declare function parseTestCase(node: AST.Expression): {
|
|
4
|
+
code: string;
|
|
5
|
+
nodes: {
|
|
6
|
+
case: AST.NoSubstitutionTemplateLiteral | AST.StringLiteral | (AST.TaggedTemplateExpression & {
|
|
7
|
+
template: AST.NoSubstitutionTemplateLiteral;
|
|
8
|
+
});
|
|
9
|
+
code: AST.NoSubstitutionTemplateLiteral | AST.StringLiteral | (AST.TaggedTemplateExpression & {
|
|
10
|
+
template: AST.NoSubstitutionTemplateLiteral;
|
|
11
|
+
});
|
|
12
|
+
fileName?: never;
|
|
13
|
+
files?: never;
|
|
14
|
+
name?: never;
|
|
15
|
+
options?: never;
|
|
16
|
+
};
|
|
17
|
+
fileName?: never;
|
|
18
|
+
files?: never;
|
|
19
|
+
name?: never;
|
|
20
|
+
options?: never;
|
|
21
|
+
} | {
|
|
22
|
+
code: string;
|
|
23
|
+
fileName: string | undefined;
|
|
24
|
+
files: Record<string, string> | undefined;
|
|
25
|
+
name: string | undefined;
|
|
26
|
+
nodes: {
|
|
27
|
+
case: AST.ObjectLiteralExpression;
|
|
28
|
+
code: AST.NoSubstitutionTemplateLiteral | AST.StringLiteral | (AST.TaggedTemplateExpression & {
|
|
29
|
+
template: AST.NoSubstitutionTemplateLiteral;
|
|
30
|
+
});
|
|
31
|
+
fileName: AST.NoSubstitutionTemplateLiteral | AST.StringLiteral | undefined;
|
|
32
|
+
files: AST.ObjectLiteralExpression | undefined;
|
|
33
|
+
name: AST.NoSubstitutionTemplateLiteral | AST.StringLiteral | undefined;
|
|
34
|
+
options: AST.ObjectLiteralExpression | undefined;
|
|
35
|
+
};
|
|
36
|
+
options: object | undefined;
|
|
37
|
+
} | undefined;
|
|
4
38
|
export declare function parseTestCaseInvalid(node: AST.Expression): ParsedTestCaseInvalid | undefined;
|
|
5
|
-
//# sourceMappingURL=parseTestCases.d.ts.map
|
|
@@ -2,4 +2,3 @@ import type { AST, Checker } from "@flint.fyi/typescript-language";
|
|
|
2
2
|
export declare function isLanguageCreateRule(node: AST.CallExpression, typeChecker: Checker): boolean;
|
|
3
3
|
export declare const isRuleCreatorCreateRule: (node: AST.CallExpression, typeChecker: Checker) => boolean;
|
|
4
4
|
export declare const isRuleContextReport: (node: AST.CallExpression, typeChecker: Checker) => boolean;
|
|
5
|
-
//# sourceMappingURL=ruleCreatorHelpers.d.ts.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { AST } from "@flint.fyi/typescript-language";
|
|
2
1
|
import ts from "typescript";
|
|
2
|
+
import type { AST } from "@flint.fyi/typescript-language";
|
|
3
3
|
export declare function tsAstToLiteral(node: AST.ArrayLiteralExpression): unknown[];
|
|
4
4
|
export declare function tsAstToLiteral(node: AST.ObjectLiteralExpression): object;
|
|
5
5
|
export declare function tsAstToLiteral(node: ts.Node): unknown;
|
|
6
|
-
//# sourceMappingURL=tsAstToLiteral.d.ts.map
|
package/lib/utils/types.d.ts
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
|
+
import type * as ts from "typescript";
|
|
1
2
|
import type { InvalidTestCase, TestCase } from "@flint.fyi/rule-tester";
|
|
2
3
|
import type { AST } from "@flint.fyi/typescript-language";
|
|
3
|
-
import type * as ts from "typescript";
|
|
4
4
|
export interface ParsedTestCase extends TestCase {
|
|
5
5
|
nodes: ParsedTestCaseNodes;
|
|
6
6
|
}
|
|
7
|
+
export type ParsedTestCaseCodeNode = AST.NoSubstitutionTemplateLiteral | AST.StringLiteral | (AST.TaggedTemplateExpression & {
|
|
8
|
+
template: AST.NoSubstitutionTemplateLiteral;
|
|
9
|
+
});
|
|
7
10
|
export interface ParsedTestCaseInvalid extends InvalidTestCase {
|
|
8
11
|
nodes: ParsedTestCaseNodesInvalid;
|
|
9
12
|
}
|
|
10
13
|
export interface ParsedTestCaseNodes {
|
|
11
14
|
case: ts.Node;
|
|
12
|
-
code:
|
|
13
|
-
fileName?:
|
|
15
|
+
code: ParsedTestCaseCodeNode;
|
|
16
|
+
fileName?: ParsedTestCaseStaticStringNode | undefined;
|
|
14
17
|
files?: AST.ObjectLiteralExpression | undefined;
|
|
15
|
-
name?:
|
|
18
|
+
name?: ParsedTestCaseStaticStringNode | undefined;
|
|
16
19
|
options?: AST.ObjectLiteralExpression | undefined;
|
|
17
20
|
}
|
|
18
21
|
export interface ParsedTestCaseNodesInvalid extends ParsedTestCaseNodes {
|
|
19
|
-
snapshot:
|
|
22
|
+
snapshot: ParsedTestCaseStaticStringNode;
|
|
20
23
|
}
|
|
21
|
-
|
|
24
|
+
export type ParsedTestCaseStaticStringNode = AST.NoSubstitutionTemplateLiteral | AST.StringLiteral;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flint.fyi/plugin-flint",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "[Experimental] A Flint plugin for linting Flint plugins.",
|
|
5
5
|
"homepage": "https://flint.fyi/rules/flint",
|
|
6
6
|
"repository": {
|
|
@@ -19,19 +19,18 @@
|
|
|
19
19
|
".": "./lib/index.js"
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
|
-
"lib/"
|
|
23
|
-
"!lib/**/*.map"
|
|
22
|
+
"lib/"
|
|
24
23
|
],
|
|
25
24
|
"dependencies": {
|
|
26
|
-
"typescript": "^
|
|
27
|
-
"@flint.fyi/
|
|
28
|
-
"@flint.fyi/
|
|
29
|
-
"@flint.fyi/
|
|
25
|
+
"typescript": "^6.0.0",
|
|
26
|
+
"@flint.fyi/core": "^0.23.3",
|
|
27
|
+
"@flint.fyi/utils": "^0.14.1",
|
|
28
|
+
"@flint.fyi/typescript-language": "^0.18.4"
|
|
30
29
|
},
|
|
31
30
|
"devDependencies": {
|
|
32
|
-
"tsdown": "0.
|
|
31
|
+
"tsdown": "0.22.3",
|
|
33
32
|
"vitest": "4.1.0",
|
|
34
|
-
"@flint.fyi/rule-tester": "^0.16.
|
|
33
|
+
"@flint.fyi/rule-tester": "^0.16.4"
|
|
35
34
|
},
|
|
36
35
|
"engines": {
|
|
37
36
|
"node": ">=24.0.0"
|