summaryrefslogtreecommitdiff
path: root/cli/flags.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-10-22 21:52:37 +0200
committerGitHub <noreply@github.com>2020-10-22 21:52:37 +0200
commitc5c48f845a4d25f064c4388fcdd4295317edf155 (patch)
tree70d4897d85ca3c89ff2a19af84883360a77b1172 /cli/flags.rs
parent9b20cfbee8d932c2f232f6bad911fe65c8257adc (diff)
feat(lint): stabilize "deno lint" subcommand (#8075)
This commit stabilizes "deno lint" by removing the need to pass --unstable flag. --unstable is still required when using --json flag.
Diffstat (limited to 'cli/flags.rs')
-rw-r--r--cli/flags.rs25
1 files changed, 8 insertions, 17 deletions
diff --git a/cli/flags.rs b/cli/flags.rs
index e0eae867c..59bcb5cd0 100644
--- a/cli/flags.rs
+++ b/cli/flags.rs
@@ -988,18 +988,18 @@ fn lint_subcommand<'a, 'b>() -> App<'a, 'b> {
.about("Lint source files")
.long_about(
"Lint JavaScript/TypeScript source code.
- deno lint --unstable
- deno lint --unstable myfile1.ts myfile2.js
+ deno lint
+ deno lint myfile1.ts myfile2.js
Print result as JSON:
deno lint --unstable --json
Read from stdin:
- cat file.ts | deno lint --unstable -
+ cat file.ts | deno lint -
cat file.ts | deno lint --unstable --json -
List available rules:
- deno lint --unstable --rules
+ deno lint --rules
Ignore diagnostics on the next line by preceding it with an ignore comment and
rule name:
@@ -1024,7 +1024,6 @@ Ignore linting a file by adding an ignore comment at the top of the file:
.arg(
Arg::with_name("ignore")
.long("ignore")
- .requires("unstable")
.takes_value(true)
.use_delimiter(true)
.require_equals(true)
@@ -1034,6 +1033,7 @@ Ignore linting a file by adding an ignore comment at the top of the file:
Arg::with_name("json")
.long("json")
.help("Output lint result in JSON format")
+ .requires("unstable")
.takes_value(false),
)
.arg(
@@ -1818,13 +1818,8 @@ mod tests {
#[test]
fn lint() {
- let r = flags_from_vec_safe(svec![
- "deno",
- "lint",
- "--unstable",
- "script_1.ts",
- "script_2.ts"
- ]);
+ let r =
+ flags_from_vec_safe(svec!["deno", "lint", "script_1.ts", "script_2.ts"]);
assert_eq!(
r.unwrap(),
Flags {
@@ -1837,7 +1832,6 @@ mod tests {
json: false,
ignore: vec![],
},
- unstable: true,
..Flags::default()
}
);
@@ -1845,7 +1839,6 @@ mod tests {
let r = flags_from_vec_safe(svec![
"deno",
"lint",
- "--unstable",
"--ignore=script_1.ts,script_2.ts"
]);
assert_eq!(
@@ -1860,12 +1853,11 @@ mod tests {
PathBuf::from("script_2.ts")
],
},
- unstable: true,
..Flags::default()
}
);
- let r = flags_from_vec_safe(svec!["deno", "lint", "--unstable", "--rules"]);
+ let r = flags_from_vec_safe(svec!["deno", "lint", "--rules"]);
assert_eq!(
r.unwrap(),
Flags {
@@ -1875,7 +1867,6 @@ mod tests {
json: false,
ignore: vec![],
},
- unstable: true,
..Flags::default()
}
);