diff options
Diffstat (limited to 'cli')
| -rw-r--r-- | cli/Cargo.toml | 8 | ||||
| -rw-r--r-- | cli/doc/ts_type.rs | 2 | ||||
| -rw-r--r-- | cli/lint.rs | 32 | ||||
| -rw-r--r-- | cli/tests/unit/utime_test.ts | 1 |
4 files changed, 23 insertions, 20 deletions
diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 0ed1574be..49cfe286e 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -20,7 +20,7 @@ deno_typescript = { path = "../deno_typescript", version = "0.48.1" } [dependencies] deno_core = { path = "../core", version = "0.48.2" } -deno_lint = "0.1.10" +deno_lint = "0.1.12" deno_typescript = { path = "../deno_typescript", version = "0.48.2" } atty = "0.2.14" @@ -30,7 +30,7 @@ byteorder = "1.3.4" clap = "2.33.1" dissimilar = "1.0.2" dlopen = "0.1.8" -dprint-plugin-typescript = "0.19.3" +dprint-plugin-typescript = "0.19.4" futures = { version = "0.3.5", features = ["compat", "io-compat"] } http = "0.2.1" indexmap = "1.4.0" @@ -47,7 +47,7 @@ serde = { version = "1.0.112", features = ["derive"] } serde_derive = "1.0.112" serde_json = { version = "1.0.55", features = [ "preserve_order" ] } sys-info = "0.7.0" -sourcemap = "5.0.0" +sourcemap = "6.0.0" tempfile = "3.1.0" termcolor = "1.1.0" tokio = { version = "0.2.21", features = ["rt-core", "tcp", "udp", "uds", "process", "fs", "blocking", "sync", "io-std", "macros", "time"] } @@ -60,7 +60,7 @@ walkdir = "2.3.1" warp = "0.2.3" semver-parser = "0.9.0" uuid = { version = "0.8.1", features = ["v4"] } -swc_ecma_visit = "0.5.1" +swc_ecma_visit = "0.7.0" [target.'cfg(windows)'.dependencies] winapi = { version = "0.3.8", features = ["knownfolders", "objbase", "shlobj", diff --git a/cli/doc/ts_type.rs b/cli/doc/ts_type.rs index ec1a5e7e9..7bb494541 100644 --- a/cli/doc/ts_type.rs +++ b/cli/doc/ts_type.rs @@ -121,7 +121,7 @@ impl Into<TsTypeDef> for &TsTupleType { let mut type_defs = vec![]; for type_box in &self.elem_types { - let ts_type: &TsType = &(*type_box); + let ts_type: &TsType = &type_box.ty; let def: TsTypeDef = ts_type.into(); type_defs.push(def) } diff --git a/cli/lint.rs b/cli/lint.rs index 956a638c8..c316e494a 100644 --- a/cli/lint.rs +++ b/cli/lint.rs @@ -12,11 +12,14 @@ use crate::file_fetcher::map_file_extension; use crate::fmt::collect_files; use crate::fmt::run_parallelized; use crate::fmt_errors; +use crate::swc_ecma_parser::Syntax; use crate::swc_util; use deno_core::ErrBox; use deno_lint::diagnostic::LintDiagnostic; use deno_lint::linter::Linter; +use deno_lint::linter::LinterBuilder; use deno_lint::rules; +use deno_lint::rules::LintRule; use std::fs; use std::path::PathBuf; use std::sync::atomic::{AtomicUsize, Ordering}; @@ -73,17 +76,19 @@ pub fn print_rules_list() { } } -fn create_linter() -> Linter { - Linter::new( - "deno-lint-ignore-file".to_string(), - vec![ - "deno-lint-ignore".to_string(), - "eslint-disable-next-line".to_string(), - ], - // TODO(bartlomieju): switch to true, once - // https://github.com/denoland/deno_lint/issues/156 is fixed - false, - ) +fn create_linter(syntax: Syntax, rules: Vec<Box<dyn LintRule>>) -> Linter { + LinterBuilder::default() + .ignore_file_directives(vec!["deno-lint-ignore-file"]) + .ignore_diagnostic_directives(vec![ + "deno-lint-ignore", + "eslint-disable-next-line", + ]) + .lint_unused_ignore_directives(true) + // TODO(bartlomieju): switch to true + .lint_unknown_rules(false) + .syntax(syntax) + .rules(rules) + .build() } fn lint_file(file_path: PathBuf) -> Result<Vec<LintDiagnostic>, ErrBox> { @@ -92,11 +97,10 @@ fn lint_file(file_path: PathBuf) -> Result<Vec<LintDiagnostic>, ErrBox> { let media_type = map_file_extension(&file_path); let syntax = swc_util::get_syntax_for_media_type(media_type); - let mut linter = create_linter(); let lint_rules = rules::get_recommended_rules(); + let mut linter = create_linter(syntax, lint_rules); - let file_diagnostics = - linter.lint(file_name, source_code, syntax, lint_rules)?; + let file_diagnostics = linter.lint(file_name, source_code)?; Ok(file_diagnostics) } diff --git a/cli/tests/unit/utime_test.ts b/cli/tests/unit/utime_test.ts index 04b636c7d..7f54349e0 100644 --- a/cli/tests/unit/utime_test.ts +++ b/cli/tests/unit/utime_test.ts @@ -8,7 +8,6 @@ import { // Allow 10 second difference. // Note this might not be enough for FAT (but we are not testing on such fs). -// eslint-disable-next-line @typescript-eslint/no-explicit-any function assertFuzzyTimestampEquals(t1: Date | null, t2: Date): void { assert(t1 instanceof Date); assert(Math.abs(t1.valueOf() - t2.valueOf()) < 10_000); |
