diff --git a/cli/graph_util.rs b/cli/graph_util.rs index 46257cf785bab4..b7df01851828b2 100644 --- a/cli/graph_util.rs +++ b/cli/graph_util.rs @@ -266,6 +266,10 @@ impl ModuleGraphCreator { let mut roots = Vec::new(); for package_config in package_configs { + eprintln!( + "resolve export {:?}", + package_config.config_file.resolve_export_value_urls()? + ); roots.extend(package_config.config_file.resolve_export_value_urls()?); } let mut graph = self @@ -276,7 +280,9 @@ impl ModuleGraphCreator { loader: None, }) .await?; - self.graph_valid(&graph)?; + let r = self.graph_valid(&graph); + eprintln!("result {:#?}", r); + r?; if self.options.type_check_mode().is_true() && !graph_has_external_remote(&graph) { diff --git a/cli/tools/lint/mod.rs b/cli/tools/lint/mod.rs index e096b486ef2b2f..2d8a558941e00c 100644 --- a/cli/tools/lint/mod.rs +++ b/cli/tools/lint/mod.rs @@ -293,8 +293,10 @@ impl WorkspaceLinter { deno_lint_config: lint_config, })); + eprintln!("paths {:#?}", paths); let mut futures = Vec::with_capacity(2); - if linter.has_package_rules() { + // Package rules are only in effect if user didn't explicitly specify paths on the command line + if paths.is_empty() && linter.has_package_rules() { if self.workspace_module_graph.is_none() { let module_graph_creator = self.module_graph_creator.clone(); let packages = self.workspace_dir.jsr_packages_for_publish(); @@ -323,9 +325,11 @@ impl WorkspaceLinter { .collect::>(); futures.push( async move { + eprintln!("workspace module graph"); let graph = workspace_module_graph_future .await .map_err(|err| anyhow!("{:#}", err))?; + eprintln!("workspace module graph2"); let export_urls = publish_config.config_file.resolve_export_value_urls()?; if !export_urls.iter().any(|url| path_urls.contains(url)) { diff --git a/cli/tools/lint/rules/no_slow_types.rs b/cli/tools/lint/rules/no_slow_types.rs index bc3f835b179be7..0328395cae4c3a 100644 --- a/cli/tools/lint/rules/no_slow_types.rs +++ b/cli/tools/lint/rules/no_slow_types.rs @@ -71,13 +71,16 @@ pub fn collect_no_slow_type_diagnostics( graph: &ModuleGraph, package_export_urls: &[ModuleSpecifier], ) -> Vec { - let mut js_exports = package_export_urls + let mut js_exports: Vec<_> = package_export_urls .iter() - .filter_map(|url| graph.get(url).and_then(|m| m.js())); + .filter_map(|url| graph.get(url).and_then(|m| m.js())) + .collect(); + + eprintln!("js exports {:#?}", js_exports); // fast check puts the same diagnostics in each entrypoint for the // package (since it's all or nothing), so we only need to check // the first one JS entrypoint - let Some(module) = js_exports.next() else { + let Some(module) = js_exports.into_iter().next() else { // could happen if all the exports are JSON return vec![]; }; diff --git a/tests/specs/lint/package_with_css_export/__test__.jsonc b/tests/specs/lint/package_with_css_export/__test__.jsonc new file mode 100644 index 00000000000000..d86957e606a31e --- /dev/null +++ b/tests/specs/lint/package_with_css_export/__test__.jsonc @@ -0,0 +1,12 @@ +{ + "tests": { + "run_dir": { + "args": "lint", + "output": "output.out" + }, + "run_file": { + "args": "lint main.ts", + "output": "Checked 1 file\n" + } + } +} diff --git a/tests/specs/lint/package_with_css_export/deno.json b/tests/specs/lint/package_with_css_export/deno.json new file mode 100644 index 00000000000000..2cbb1b180cb8a7 --- /dev/null +++ b/tests/specs/lint/package_with_css_export/deno.json @@ -0,0 +1,7 @@ +{ + "name": "@project/ui", + "exports": { + "./main.ts": "./main.ts", + "./globals.css": "./globals.css" + } +} diff --git a/tests/specs/lint/package_with_css_export/globals.css b/tests/specs/lint/package_with_css_export/globals.css new file mode 100644 index 00000000000000..079970d42aef09 --- /dev/null +++ b/tests/specs/lint/package_with_css_export/globals.css @@ -0,0 +1,3 @@ +body { + color: "red"; +} diff --git a/tests/specs/lint/package_with_css_export/main.ts b/tests/specs/lint/package_with_css_export/main.ts new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/tests/specs/lint/package_with_css_export/output.out b/tests/specs/lint/package_with_css_export/output.out new file mode 100644 index 00000000000000..e69de29bb2d1d6