You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
message: "External imports are not allowed outside of tools",
81
+
hint:
82
+
'Use code from within `@std` instead of external code. E.g. Use `import { foo } from "@std/foo"` instead of `import { foo } from "https://deno.land/x/foo/mod.ts"`.',
Copy file name to clipboardExpand all lines: _tools/lint_plugin_test.ts
+30Lines changed: 30 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -56,6 +56,36 @@ class MyClass {
56
56
);
57
57
});
58
58
59
+
Deno.test("deno-style-guide/no-external-code",{
60
+
ignore: !Deno.version.deno.startsWith("2"),
61
+
},()=>{
62
+
// Good
63
+
assertLintPluginDiagnostics('import { walk } from "@std/fs/walk";',[]);
64
+
65
+
// Bad
66
+
assertLintPluginDiagnostics(
67
+
`
68
+
import { bad } from "https://deno.land/malicious-muffin/bad.ts";
69
+
import { bad } from "jsr:@malicious-muffin/bad";
70
+
`,
71
+
[{
72
+
id: "deno-style-guide/no-external-code",
73
+
fix: [],
74
+
range: [1,65],
75
+
message: "External imports are not allowed outside of tools",
76
+
hint:
77
+
'Use code from within `@std` instead of external code. E.g. Use `import { foo } from "@std/foo"` instead of `import { foo } from "https://deno.land/x/foo/mod.ts"`.',
78
+
},{
79
+
id: "deno-style-guide/no-external-code",
80
+
fix: [],
81
+
range: [66,114],
82
+
message: "External imports are not allowed outside of tools",
83
+
hint:
84
+
'Use code from within `@std` instead of external code. E.g. Use `import { foo } from "@std/foo"` instead of `import { foo } from "https://deno.land/x/foo/mod.ts"`.',
0 commit comments