@typespec/library-linter 0.67.0-dev.1 → 0.67.0-dev.3
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/src/linter.d.ts.map +1 -1
- package/dist/src/linter.js +10 -18
- package/dist/src/linter.js.map +1 -1
- package/package.json +3 -3
package/dist/src/linter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linter.d.ts","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,OAAO,
|
|
1
|
+
{"version":3,"file":"linter.d.ts","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,OAAO,EAAQ,MAAM,oBAAoB,CAAC;AAI9D,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,QAK3C"}
|
package/dist/src/linter.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { SyntaxKind } from "@typespec/compiler";
|
|
1
|
+
import { SyntaxKind } from "@typespec/compiler/ast";
|
|
2
2
|
import { reportDiagnostic } from "./lib.js";
|
|
3
3
|
export function $onValidate(program) {
|
|
4
|
-
const root = program.
|
|
4
|
+
const root = program.getGlobalNamespaceType();
|
|
5
5
|
validateNoExportAtRoot(program, root);
|
|
6
6
|
validateDecoratorSignature(program);
|
|
7
7
|
}
|
|
@@ -20,27 +20,19 @@ function validateNoExportAtRoot(program, root) {
|
|
|
20
20
|
validateFor(root.enums);
|
|
21
21
|
validateFor(root.operations);
|
|
22
22
|
validateFor(root.unions);
|
|
23
|
-
for (const [name,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
else if (sym.flags & 8192 /* SymbolFlags.Function */) {
|
|
32
|
-
reportDiagnostic(program, {
|
|
33
|
-
code: "missing-namespace",
|
|
34
|
-
format: { type: "Function", name },
|
|
35
|
-
target: sym,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
23
|
+
for (const [name, dec] of root.decoratorDeclarations) {
|
|
24
|
+
reportDiagnostic(program, {
|
|
25
|
+
code: "missing-namespace",
|
|
26
|
+
format: { type: "Decorator", name: `@${name}` },
|
|
27
|
+
target: dec,
|
|
28
|
+
});
|
|
38
29
|
}
|
|
39
30
|
}
|
|
40
31
|
const excludeDecoratorSignature = new Set(["@docFromComment", "@indexer", "@test"]);
|
|
41
32
|
function validateDecoratorSignature(program) {
|
|
42
33
|
function navigate(sym) {
|
|
43
|
-
|
|
34
|
+
// SymbolFlags.Decorator = 1 << 9
|
|
35
|
+
if (sym.flags & (1 << 9)) {
|
|
44
36
|
const hasSignature = sym.declarations.some((x) => x.kind === SyntaxKind.DecoratorDeclarationStatement);
|
|
45
37
|
if (!hasSignature && !excludeDecoratorSignature.has(sym.name)) {
|
|
46
38
|
reportDiagnostic(program, {
|
package/dist/src/linter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linter.js","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"linter.js","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,MAAM,UAAU,WAAW,CAAC,OAAgB;IAC1C,MAAM,IAAI,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC;IAE9C,sBAAsB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACtC,0BAA0B,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC;AAED,SAAS,sBAAsB,CAAC,OAAgB,EAAE,IAAe;IAC/D,SAAS,WAAW,CAAC,KAA4C;QAC/D,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;YAClC,gBAAgB,CAAC,O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I,CAAC,EAAE,CAAC;gBAC9D,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,mBAAmB;oBACzB,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;oBACtC,MAAM,EAAE,GAAG;iBACZ,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QACD,KAAK,MAAM,GAAG,IAAI,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC;YAC9C,QAAQ,CAAC,GAAG,CAAC,CAAC;QAChB,CAAC;IACH,CAAC;IAED,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE,CAAC;QACpD,QAAQ,CAAE,MAAc,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typespec/library-linter",
|
|
3
|
-
"version": "0.67.0-dev.
|
|
3
|
+
"version": "0.67.0-dev.3",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "TypeSpec library for linting another library.",
|
|
6
6
|
"homepage": "https://typespec.io",
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"!dist/test/**"
|
|
40
40
|
],
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@typespec/compiler": "
|
|
42
|
+
"@typespec/compiler": "^0.66.0 || >=0.67.0-dev <0.67.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/node": "~22.13.9",
|
|
46
|
-
"@typespec/compiler": "
|
|
46
|
+
"@typespec/compiler": "^0.66.0 || >=0.67.0-dev <0.67.0",
|
|
47
47
|
"@vitest/coverage-v8": "^3.0.7",
|
|
48
48
|
"@vitest/ui": "^3.0.7",
|
|
49
49
|
"c8": "^10.1.3",
|