Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(unstable/lint): no-slow-types for JSR packages #22430

Merged
merged 16 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ winres.workspace = true
[dependencies]
deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "proposal", "react", "sourcemap", "transforms", "typescript", "view", "visit"] }
deno_cache_dir = { workspace = true }
deno_config = "=0.9.2"
deno_config = "=0.10.0"
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
deno_doc = { version = "=0.107.0", features = ["html"] }
deno_emit = "=0.37.0"
deno_graph = "=0.66.0"
deno_graph = "=0.66.2"
deno_lint = { version = "=0.56.0", features = ["docs"] }
deno_lockfile.workspace = true
deno_npm = "=0.17.0"
Expand Down
10 changes: 5 additions & 5 deletions cli/args/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ pub struct VendorFlags {
pub struct PublishFlags {
pub token: Option<String>,
pub dry_run: bool,
pub no_zap: bool,
pub allow_slow_types: bool,
}

#[derive(Clone, Debug, Eq, PartialEq)]
Expand Down Expand Up @@ -2389,9 +2389,9 @@ fn publish_subcommand() -> Command {
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("no-zap")
.long("no-zap")
.help("Skip Zap compatibility validation")
Arg::new("allow-slow-types")
.long("allow-slow-types")
.help("Allow publishing with slow types")
.action(ArgAction::SetTrue),
)
})
Expand Down Expand Up @@ -3828,7 +3828,7 @@ fn publish_parse(flags: &mut Flags, matches: &mut ArgMatches) {
flags.subcommand = DenoSubcommand::Publish(PublishFlags {
token: matches.remove_one("token"),
dry_run: matches.get_flag("dry-run"),
no_zap: matches.get_flag("no-zap"),
allow_slow_types: matches.get_flag("allow-slow-types"),
});
}

Expand Down
24 changes: 22 additions & 2 deletions cli/graph_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use crate::util::sync::TaskQueue;
use crate::util::sync::TaskQueuePermit;

use deno_config::ConfigFile;
use deno_config::WorkspaceMemberConfig;
use deno_core::anyhow::bail;
use deno_core::anyhow::Context;
use deno_core::error::custom_error;
Expand Down Expand Up @@ -277,7 +278,7 @@ impl ModuleGraphBuilder {
graph_kind: GraphKind,
roots: Vec<ModuleSpecifier>,
loader: &mut dyn Loader,
) -> Result<deno_graph::ModuleGraph, AnyError> {
) -> Result<ModuleGraph, AnyError> {
self
.create_graph_with_options(CreateGraphOptions {
is_dynamic: false,
Expand All @@ -289,10 +290,29 @@ impl ModuleGraphBuilder {
.await
}

pub async fn create_publish_graph(
&self,
packages: &[WorkspaceMemberConfig],
) -> Result<ModuleGraph, AnyError> {
let mut roots = Vec::new();
for package in packages {
roots.extend(package.config_file.resolve_export_value_urls()?);
}
self
.create_graph_with_options(CreateGraphOptions {
is_dynamic: false,
graph_kind: deno_graph::GraphKind::All,
roots,
workspace_fast_check: true,
loader: None,
})
.await
}

pub async fn create_graph_with_options(
&self,
options: CreateGraphOptions<'_>,
) -> Result<deno_graph::ModuleGraph, AnyError> {
) -> Result<ModuleGraph, AnyError> {
let mut graph = ModuleGraph::new(options.graph_kind);

self
Expand Down
6 changes: 5 additions & 1 deletion cli/lsp/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,11 @@ fn generate_lint_diagnostics(
let documents = snapshot
.documents
.documents(DocumentsFilter::OpenDiagnosable);
let lint_rules = get_configured_rules(lint_options.rules.clone());
let lint_rules = get_configured_rules(
lint_options.rules.clone(),
config.config_file.as_ref(),
)
.rules;
let mut diagnostics_vec = Vec::new();
for document in documents {
let settings =
Expand Down
Loading