mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 09:31:22 -05:00
fix(check): use "moduleDetection": "force" (#14875)
This commit is contained in:
parent
0b90e966c5
commit
845d4754c6
15 changed files with 44 additions and 30 deletions
|
@ -197,6 +197,9 @@ pub fn get_ts_config(
|
|||
} else {
|
||||
ts_config.merge_tsconfig_from_config_file(maybe_config_file)?
|
||||
};
|
||||
ts_config.merge(&json!({
|
||||
"moduleDetection": "force",
|
||||
}));
|
||||
Ok((ts_config, maybe_ignored_options))
|
||||
}
|
||||
|
||||
|
|
|
@ -649,6 +649,7 @@ impl Inner {
|
|||
"jsx": "react",
|
||||
"lib": ["deno.ns", "deno.window"],
|
||||
"module": "esnext",
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
"resolveJsonModule": true,
|
||||
"strict": true,
|
||||
|
|
|
@ -32,3 +32,8 @@ itest!(check_all_local {
|
|||
output_str: Some(""),
|
||||
http_server: true,
|
||||
});
|
||||
|
||||
itest!(module_detection_force {
|
||||
args: "check --quiet module_detection_force.ts",
|
||||
output_str: Some(""),
|
||||
});
|
||||
|
|
8
cli/tests/testdata/046_jsx_test.tsx
vendored
8
cli/tests/testdata/046_jsx_test.tsx
vendored
|
@ -1,6 +1,8 @@
|
|||
declare namespace JSX {
|
||||
interface IntrinsicElements {
|
||||
[elemName: string]: any;
|
||||
declare global {
|
||||
export namespace JSX {
|
||||
interface IntrinsicElements {
|
||||
[elemName: string]: any;
|
||||
}
|
||||
}
|
||||
}
|
||||
const React = {
|
||||
|
|
2
cli/tests/testdata/error_for_await.ts
vendored
2
cli/tests/testdata/error_for_await.ts
vendored
|
@ -10,5 +10,3 @@ function handleConn(conn: Deno.Conn) {
|
|||
event.respondWith(new Response("html", { status: 200 }));
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
|
|
|
@ -1,4 +1,24 @@
|
|||
[
|
||||
{
|
||||
"title": "Extract to function in module scope",
|
||||
"kind": "refactor.extract.function",
|
||||
"isPreferred": false,
|
||||
"data": {
|
||||
"specifier": "file:///a/file.ts",
|
||||
"range": {
|
||||
"start": {
|
||||
"line": 0,
|
||||
"character": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 14,
|
||||
"character": 0
|
||||
}
|
||||
},
|
||||
"refactorName": "Extract Symbol",
|
||||
"actionName": "function_scope_0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Move to a new file",
|
||||
"kind": "refactor.move.newFile",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[
|
||||
{
|
||||
"title": "Extract to function in global scope",
|
||||
"title": "Extract to function in module scope",
|
||||
"kind": "refactor.extract.function",
|
||||
"isPreferred": false,
|
||||
"data": {
|
||||
|
|
3
cli/tests/testdata/module_detection_force.ts
vendored
Normal file
3
cli/tests/testdata/module_detection_force.ts
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
const a = 1;
|
||||
await import("./module_detection_force_import.ts");
|
||||
console.log(a);
|
2
cli/tests/testdata/module_detection_force_import.ts
vendored
Normal file
2
cli/tests/testdata/module_detection_force_import.ts
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
const a = 2;
|
||||
console.log(a);
|
2
cli/tests/testdata/subdir/polyfill.ts
vendored
2
cli/tests/testdata/subdir/polyfill.ts
vendored
|
@ -2,8 +2,6 @@ declare global {
|
|||
const polyfill: () => void;
|
||||
}
|
||||
|
||||
export {};
|
||||
|
||||
// deno-lint-ignore no-explicit-any
|
||||
(globalThis as any).polyfill = () => {
|
||||
console.log("polyfill");
|
||||
|
|
1
cli/tests/testdata/subdir/single_module.ts
vendored
1
cli/tests/testdata/subdir/single_module.ts
vendored
|
@ -1,2 +1 @@
|
|||
console.log("Hello world!");
|
||||
export {}; // TODO(ry) This shouldn't be necessary.
|
||||
|
|
|
@ -2,5 +2,3 @@
|
|||
const { printHello } = await import("../mod2.ts");
|
||||
printHello();
|
||||
})();
|
||||
|
||||
export {};
|
||||
|
|
|
@ -24,5 +24,3 @@ globalThis.addEventListener("unload", () => {
|
|||
);
|
||||
}
|
||||
});
|
||||
|
||||
export {};
|
||||
|
|
|
@ -884,8 +884,6 @@ fn extract_files_from_regex_blocks(
|
|||
file_source.push_str(&format!("{}\n", text.as_str()));
|
||||
}
|
||||
|
||||
file_source.push_str("export {};");
|
||||
|
||||
let file_specifier = deno_core::resolve_url_or_path(&format!(
|
||||
"{}${}-{}{}",
|
||||
specifier,
|
||||
|
|
|
@ -83,10 +83,10 @@ delete Object.prototype.__proto__;
|
|||
|
||||
// deno-fmt-ignore
|
||||
const base64abc = [
|
||||
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O",
|
||||
"P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d",
|
||||
"e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s",
|
||||
"t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7",
|
||||
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O",
|
||||
"P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d",
|
||||
"e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s",
|
||||
"t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7",
|
||||
"8", "9", "+", "/",
|
||||
];
|
||||
|
||||
|
@ -188,17 +188,6 @@ delete Object.prototype.__proto__;
|
|||
/** Diagnostics that are intentionally ignored when compiling TypeScript in
|
||||
* Deno, as they provide misleading or incorrect information. */
|
||||
const IGNORED_DIAGNOSTICS = [
|
||||
// TS1208: All files must be modules when the '--isolatedModules' flag is
|
||||
// provided. We can ignore because we guarantee that all files are
|
||||
// modules.
|
||||
1208,
|
||||
// TS1375: 'await' expressions are only allowed at the top level of a file
|
||||
// when that file is a module, but this file has no imports or exports.
|
||||
// Consider adding an empty 'export {}' to make this file a module.
|
||||
1375,
|
||||
// TS2306: File 'file:///Users/rld/src/deno/cli/tests/testdata/subdir/amd_like.js' is
|
||||
// not a module.
|
||||
2306,
|
||||
// TS2688: Cannot find type definition file for '...'.
|
||||
// We ignore because type defintion files can end with '.ts'.
|
||||
2688,
|
||||
|
|
Loading…
Add table
Reference in a new issue