From 15a6ea9d500453b05ad2f787ffe0473bf2c0dc95 Mon Sep 17 00:00:00 2001 From: unvalley Date: Fri, 7 Jul 2023 02:41:09 +0900 Subject: [PATCH 1/3] fix(rome_js_analyze): noNonoctalDecimalEscape returns single diagnostic to each text range --- .../nursery/no_nonoctal_decimal_escape.rs | 29 +- .../noNonoctalDecimalEscape/invalid.js.snap | 1237 +---------------- 2 files changed, 38 insertions(+), 1228 deletions(-) diff --git a/crates/rome_js_analyze/src/analyzers/nursery/no_nonoctal_decimal_escape.rs b/crates/rome_js_analyze/src/analyzers/nursery/no_nonoctal_decimal_escape.rs index 2006452418e..fc51d3936cb 100644 --- a/crates/rome_js_analyze/src/analyzers/nursery/no_nonoctal_decimal_escape.rs +++ b/crates/rome_js_analyze/src/analyzers/nursery/no_nonoctal_decimal_escape.rs @@ -5,7 +5,7 @@ use rome_diagnostics::Applicability; use rome_js_factory::make; use rome_js_syntax::JsStringLiteralExpression; use rome_rowan::{AstNode, BatchMutationExt, TextRange}; -use std::ops::Range; +use std::{collections::HashSet, ops::Range}; declare_rule! { /// Disallow `\8` and `\9` escape sequences in string literals. @@ -69,7 +69,7 @@ declare_rule! { #[derive(Debug)] pub(crate) enum FixSuggestionKind { Refactor, - EscapeBackslash, + // EscapeBackslash, } #[derive(Debug)] @@ -156,16 +156,19 @@ impl Rule for NoNonoctalDecimalEscape { replace_string_range: replace_string_range.clone(), }) } + // \8 -> \\8 + // signals.push(RuleState { + // kind: FixSuggestionKind::EscapeBackslash, + // diagnostics_text_range: decimal_escape_range, + // replace_to: format!("\\{}", decimal_escape), + // replace_from: decimal_escape.to_string(), + // replace_string_range, + // }); } - // \8 -> \\8 - signals.push(RuleState { - kind: FixSuggestionKind::EscapeBackslash, - diagnostics_text_range: decimal_escape_range, - replace_to: format!("\\{}", decimal_escape), - replace_from: decimal_escape.to_string(), - replace_string_range, - }); } + + let mut seen = HashSet::new(); + signals.retain(|rule_state| seen.insert(rule_state.diagnostics_text_range)); signals } @@ -219,9 +222,9 @@ impl Rule for NoNonoctalDecimalEscape { FixSuggestionKind::Refactor => { markup! ("Replace "{replace_from}" with "{replace_to}". This maintains the current functionality.").to_owned() } - FixSuggestionKind::EscapeBackslash => { - markup! ("Replace "{replace_from}" with "{replace_to}" to include the actual backslash character." ).to_owned() - } + // FixSuggestionKind::EscapeBackslash => { + // markup! ("Replace "{replace_from}" with "{replace_to}" to include the actual backslash character." ).to_owned() + // } }, mutation, }) diff --git a/crates/rome_js_analyze/tests/specs/nursery/noNonoctalDecimalEscape/invalid.js.snap b/crates/rome_js_analyze/tests/specs/nursery/noNonoctalDecimalEscape/invalid.js.snap index b41778a4a68..a38bbe39364 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noNonoctalDecimalEscape/invalid.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noNonoctalDecimalEscape/invalid.js.snap @@ -71,25 +71,6 @@ invalid.js:1:10 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:1:10 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - > 1 │ let x = "\8" - │ ^^ - 2 │ let x = "\9" - 3 │ let x = "\"\8\"" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 1 │ let·x·=·"\\8" - │ + - -``` - ``` invalid.js:2:10 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -110,26 +91,6 @@ invalid.js:2:10 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:2:10 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 1 │ let x = "\8" - > 2 │ let x = "\9" - │ ^^ - 3 │ let x = "\"\8\"" - 4 │ let x = "f\9" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \9 with \\9 to include the actual backslash character. - - 2 │ let·x·=·"\\9" - │ + - -``` - ``` invalid.js:3:12 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -151,27 +112,6 @@ invalid.js:3:12 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:3:12 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 1 │ let x = "\8" - 2 │ let x = "\9" - > 3 │ let x = "\"\8\"" - │ ^^ - 4 │ let x = "f\9" - 5 │ let x = "fo\9" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 3 │ let·x·=·"\"\\8\"" - │ + - -``` - ``` invalid.js:4:11 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -198,27 +138,6 @@ invalid.js:4:11 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:4:11 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 2 │ let x = "\9" - 3 │ let x = "\"\8\"" - > 4 │ let x = "f\9" - │ ^^ - 5 │ let x = "fo\9" - 6 │ let x = "foo\9" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \9 with \\9 to include the actual backslash character. - - 4 │ let·x·=·"f\\9" - │ + - -``` - ``` invalid.js:5:12 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -245,27 +164,6 @@ invalid.js:5:12 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:5:12 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 3 │ let x = "\"\8\"" - 4 │ let x = "f\9" - > 5 │ let x = "fo\9" - │ ^^ - 6 │ let x = "foo\9" - 7 │ let x = "foo\8bar" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \9 with \\9 to include the actual backslash character. - - 5 │ let·x·=·"fo\\9" - │ + - -``` - ``` invalid.js:6:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -292,27 +190,6 @@ invalid.js:6:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:6:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 4 │ let x = "f\9" - 5 │ let x = "fo\9" - > 6 │ let x = "foo\9" - │ ^^ - 7 │ let x = "foo\8bar" - 8 │ let x = "👍\8" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \9 with \\9 to include the actual backslash character. - - 6 │ let·x·=·"foo\\9" - │ + - -``` - ``` invalid.js:7:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -339,27 +216,6 @@ invalid.js:7:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:7:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 5 │ let x = "fo\9" - 6 │ let x = "foo\9" - > 7 │ let x = "foo\8bar" - │ ^^ - 8 │ let x = "👍\8" - 9 │ let x = "\\\8" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 7 │ let·x·=·"foo\\8bar" - │ + - -``` - ``` invalid.js:8:11 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -381,27 +237,6 @@ invalid.js:8:11 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:8:11 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 6 │ let x = "foo\9" - 7 │ let x = "foo\8bar" - > 8 │ let x = "👍\8" - │ ^^ - 9 │ let x = "\\\8" - 10 │ let x = "\\\\\9" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 8 │ let·x·=·"👍\\8" - │ + - -``` - ``` invalid.js:9:12 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -423,27 +258,6 @@ invalid.js:9:12 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:9:12 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 7 │ let x = "foo\8bar" - 8 │ let x = "👍\8" - > 9 │ let x = "\\\8" - │ ^^ - 10 │ let x = "\\\\\9" - 11 │ let x = "foo\\\8" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 9 │ let·x·=·"\\\\8" - │ + - -``` - ``` invalid.js:10:14 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -465,27 +279,6 @@ invalid.js:10:14 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:10:14 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 8 │ let x = "👍\8" - 9 │ let x = "\\\8" - > 10 │ let x = "\\\\\9" - │ ^^ - 11 │ let x = "foo\\\8" - 12 │ let x = "\\ \8" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \9 with \\9 to include the actual backslash character. - - 10 │ let·x·=·"\\\\\\9" - │ + - -``` - ``` invalid.js:11:15 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -507,27 +300,6 @@ invalid.js:11:15 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:11:15 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 9 │ let x = "\\\8" - 10 │ let x = "\\\\\9" - > 11 │ let x = "foo\\\8" - │ ^^ - 12 │ let x = "\\ \8" - 13 │ let x = "\\1\9" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 11 │ let·x·=·"foo\\\\8" - │ + - -``` - ``` invalid.js:12:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -549,27 +321,6 @@ invalid.js:12:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:12:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 10 │ let x = "\\\\\9" - 11 │ let x = "foo\\\8" - > 12 │ let x = "\\ \8" - │ ^^ - 13 │ let x = "\\1\9" - 14 │ let x = "foo\\1\9" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 12 │ let·x·=·"\\·\\8" - │ + - -``` - ``` invalid.js:13:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -596,27 +347,6 @@ invalid.js:13:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:13:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 11 │ let x = "foo\\\8" - 12 │ let x = "\\ \8" - > 13 │ let x = "\\1\9" - │ ^^ - 14 │ let x = "foo\\1\9" - 15 │ let x = "\\n\\n\8\\n" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \9 with \\9 to include the actual backslash character. - - 13 │ let·x·=·"\\1\\9" - │ + - -``` - ``` invalid.js:14:16 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -643,27 +373,6 @@ invalid.js:14:16 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:14:16 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 12 │ let x = "\\ \8" - 13 │ let x = "\\1\9" - > 14 │ let x = "foo\\1\9" - │ ^^ - 15 │ let x = "\\n\\n\8\\n" - 16 │ let x = "\\n.\\n\8\\n" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \9 with \\9 to include the actual backslash character. - - 14 │ let·x·=·"foo\\1\\9" - │ + - -``` - ``` invalid.js:15:16 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -691,28 +400,7 @@ invalid.js:15:16 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` ``` -invalid.js:15:16 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 13 │ let x = "\\1\9" - 14 │ let x = "foo\\1\9" - > 15 │ let x = "\\n\\n\8\\n" - │ ^^ - 16 │ let x = "\\n.\\n\8\\n" - 17 │ let x = "\\n.\\nn\8\\n" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 15 │ let·x·=·"\\n\\n\\8\\n" - │ + - -``` - -``` -invalid.js:16:17 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:16:17 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Don't use `\8` and `\9` escape sequences in string literals. @@ -737,27 +425,6 @@ invalid.js:16:17 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:16:17 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 14 │ let x = "foo\\1\9" - 15 │ let x = "\\n\\n\8\\n" - > 16 │ let x = "\\n.\\n\8\\n" - │ ^^ - 17 │ let x = "\\n.\\nn\8\\n" - 18 │ let x = "\\👍\8" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 16 │ let·x·=·"\\n.\\n\\8\\n" - │ + - -``` - ``` invalid.js:17:18 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -784,27 +451,6 @@ invalid.js:17:18 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:17:18 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 15 │ let x = "\\n\\n\8\\n" - 16 │ let x = "\\n.\\n\8\\n" - > 17 │ let x = "\\n.\\nn\8\\n" - │ ^^ - 18 │ let x = "\\👍\8" - 19 │ let x = "\\\8\9" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 17 │ let·x·=·"\\n.\\nn\\8\\n" - │ + - -``` - ``` invalid.js:18:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -826,27 +472,6 @@ invalid.js:18:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:18:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 16 │ let x = "\\n.\\n\8\\n" - 17 │ let x = "\\n.\\nn\8\\n" - > 18 │ let x = "\\👍\8" - │ ^^ - 19 │ let x = "\\\8\9" - 20 │ let x = "\8\\\9" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 18 │ let·x·=·"\\👍\\8" - │ + - -``` - ``` invalid.js:19:12 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -868,48 +493,6 @@ invalid.js:19:12 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:19:12 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 17 │ let x = "\\n.\\nn\8\\n" - 18 │ let x = "\\👍\8" - > 19 │ let x = "\\\8\9" - │ ^^ - 20 │ let x = "\8\\\9" - 21 │ let x = "\8 \\\9" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 19 │ let·x·=·"\\\\8\9" - │ + - -``` - -``` -invalid.js:19:14 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 17 │ let x = "\\n.\\nn\8\\n" - 18 │ let x = "\\👍\8" - > 19 │ let x = "\\\8\9" - │ ^^ - 20 │ let x = "\8\\\9" - 21 │ let x = "\8 \\\9" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \9 with \\9 to include the actual backslash character. - - 19 │ let·x·=·"\\\8\\9" - │ + - -``` - ``` invalid.js:20:10 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -931,48 +514,6 @@ invalid.js:20:10 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:20:10 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 18 │ let x = "\\👍\8" - 19 │ let x = "\\\8\9" - > 20 │ let x = "\8\\\9" - │ ^^ - 21 │ let x = "\8 \\\9" - 22 │ let x = "\8\8" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 20 │ let·x·=·"\\8\\\9" - │ + - -``` - -``` -invalid.js:20:14 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 18 │ let x = "\\👍\8" - 19 │ let x = "\\\8\9" - > 20 │ let x = "\8\\\9" - │ ^^ - 21 │ let x = "\8 \\\9" - 22 │ let x = "\8\8" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \9 with \\9 to include the actual backslash character. - - 20 │ let·x·=·"\8\\\\9" - │ + - -``` - ``` invalid.js:21:10 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -994,48 +535,6 @@ invalid.js:21:10 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:21:10 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 19 │ let x = "\\\8\9" - 20 │ let x = "\8\\\9" - > 21 │ let x = "\8 \\\9" - │ ^^ - 22 │ let x = "\8\8" - 23 │ let x = "\9\8" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 21 │ let·x·=·"\\8·\\\9" - │ + - -``` - -``` -invalid.js:21:15 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 19 │ let x = "\\\8\9" - 20 │ let x = "\8\\\9" - > 21 │ let x = "\8 \\\9" - │ ^^ - 22 │ let x = "\8\8" - 23 │ let x = "\9\8" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \9 with \\9 to include the actual backslash character. - - 21 │ let·x·=·"\8·\\\\9" - │ + - -``` - ``` invalid.js:21:15 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -1078,48 +577,6 @@ invalid.js:22:10 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:22:10 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 20 │ let x = "\8\\\9" - 21 │ let x = "\8 \\\9" - > 22 │ let x = "\8\8" - │ ^^ - 23 │ let x = "\9\8" - 24 │ let x = "foo\8bar\9baz" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 22 │ let·x·=·"\\8\8" - │ + - -``` - -``` -invalid.js:22:12 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 20 │ let x = "\8\\\9" - 21 │ let x = "\8 \\\9" - > 22 │ let x = "\8\8" - │ ^^ - 23 │ let x = "\9\8" - 24 │ let x = "foo\8bar\9baz" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 22 │ let·x·=·"\8\\8" - │ + - -``` - ``` invalid.js:23:10 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -1128,126 +585,42 @@ invalid.js:23:10 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ 21 │ let x = "\8 \\\9" 22 │ let x = "\8\8" > 23 │ let x = "\9\8" - │ ^^ - 24 │ let x = "foo\8bar\9baz" - 25 │ let x = "\8\\1\9" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \9 with 9. This maintains the current functionality. - - 23 │ let·x·=·"\9\8" - │ - - -``` - -``` -invalid.js:23:10 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 21 │ let x = "\8 \\\9" - 22 │ let x = "\8\8" - > 23 │ let x = "\9\8" - │ ^^ - 24 │ let x = "foo\8bar\9baz" - 25 │ let x = "\8\\1\9" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \9 with \\9 to include the actual backslash character. - - 23 │ let·x·=·"\\9\8" - │ + - -``` - -``` -invalid.js:23:12 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 21 │ let x = "\8 \\\9" - 22 │ let x = "\8\8" - > 23 │ let x = "\9\8" - │ ^^ - 24 │ let x = "foo\8bar\9baz" - 25 │ let x = "\8\\1\9" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 23 │ let·x·=·"\9\\8" - │ + - -``` - -``` -invalid.js:24:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 22 │ let x = "\8\8" - 23 │ let x = "\9\8" - > 24 │ let x = "foo\8bar\9baz" - │ ^^ - 25 │ let x = "\8\\1\9" - 26 │ let x = "\9\\n9\\\9\9" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with 8. This maintains the current functionality. - - 22 22 │ let x = "\8\8" - 23 23 │ let x = "\9\8" - 24 │ - let·x·=·"foo\8bar\9baz" - 24 │ + let·x·=·"foo8bar\9baz" - 25 25 │ let x = "\8\\1\9" - 26 26 │ let x = "\9\\n9\\\9\9" - - -``` - -``` -invalid.js:24:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 22 │ let x = "\8\8" - 23 │ let x = "\9\8" - > 24 │ let x = "foo\8bar\9baz" - │ ^^ + │ ^^ + 24 │ let x = "foo\8bar\9baz" 25 │ let x = "\8\\1\9" - 26 │ let x = "\9\\n9\\\9\9" i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. + i Suggested fix: Replace \9 with 9. This maintains the current functionality. - 24 │ let·x·=·"foo\\8bar\9baz" - │ + + 23 │ let·x·=·"\9\8" + │ - ``` ``` -invalid.js:24:18 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.js:24:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Don't use `\8` and `\9` escape sequences in string literals. 22 │ let x = "\8\8" 23 │ let x = "\9\8" > 24 │ let x = "foo\8bar\9baz" - │ ^^ + │ ^^ 25 │ let x = "\8\\1\9" 26 │ let x = "\9\\n9\\\9\9" i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - i Suggested fix: Replace \9 with \\9 to include the actual backslash character. + i Suggested fix: Replace \8 with 8. This maintains the current functionality. + + 22 22 │ let x = "\8\8" + 23 23 │ let x = "\9\8" + 24 │ - let·x·=·"foo\8bar\9baz" + 24 │ + let·x·=·"foo8bar\9baz" + 25 25 │ let x = "\8\\1\9" + 26 26 │ let x = "\9\\n9\\\9\9" - 24 │ let·x·=·"foo\8bar\\9baz" - │ + ``` @@ -1298,48 +671,6 @@ invalid.js:25:10 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:25:10 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 23 │ let x = "\9\8" - 24 │ let x = "foo\8bar\9baz" - > 25 │ let x = "\8\\1\9" - │ ^^ - 26 │ let x = "\9\\n9\\\9\9" - 27 │ let x = "\8\\\\\9" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 25 │ let·x·=·"\\8\\1\9" - │ + - -``` - -``` -invalid.js:25:15 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 23 │ let x = "\9\8" - 24 │ let x = "foo\8bar\9baz" - > 25 │ let x = "\8\\1\9" - │ ^^ - 26 │ let x = "\9\\n9\\\9\9" - 27 │ let x = "\8\\\\\9" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \9 with \\9 to include the actual backslash character. - - 25 │ let·x·=·"\8\\1\\9" - │ + - -``` - ``` invalid.js:25:15 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -1387,27 +718,6 @@ invalid.js:26:10 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:26:10 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 24 │ let x = "foo\8bar\9baz" - 25 │ let x = "\8\\1\9" - > 26 │ let x = "\9\\n9\\\9\9" - │ ^^ - 27 │ let x = "\8\\\\\9" - 28 │ let x = "var foo = '\8'; bar('\9')" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \9 with \\9 to include the actual backslash character. - - 26 │ let·x·=·"\\9\\n9\\\9\9" - │ + - -``` - ``` invalid.js:26:18 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -1429,48 +739,6 @@ invalid.js:26:18 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:26:18 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 24 │ let x = "foo\8bar\9baz" - 25 │ let x = "\8\\1\9" - > 26 │ let x = "\9\\n9\\\9\9" - │ ^^ - 27 │ let x = "\8\\\\\9" - 28 │ let x = "var foo = '\8'; bar('\9')" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \9 with \\9 to include the actual backslash character. - - 26 │ let·x·=·"\9\\n9\\\\9\9" - │ + - -``` - -``` -invalid.js:26:20 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 24 │ let x = "foo\8bar\9baz" - 25 │ let x = "\8\\1\9" - > 26 │ let x = "\9\\n9\\\9\9" - │ ^^ - 27 │ let x = "\8\\\\\9" - 28 │ let x = "var foo = '\8'; bar('\9')" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \9 with \\9 to include the actual backslash character. - - 26 │ let·x·=·"\9\\n9\\\9\\9" - │ + - -``` - ``` invalid.js:27:10 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -1492,48 +760,6 @@ invalid.js:27:10 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:27:10 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 25 │ let x = "\8\\1\9" - 26 │ let x = "\9\\n9\\\9\9" - > 27 │ let x = "\8\\\\\9" - │ ^^ - 28 │ let x = "var foo = '\8'; bar('\9')" - 29 │ let x = "var foo = '8'\n bar = '\9'" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 27 │ let·x·=·"\\8\\\\\9" - │ + - -``` - -``` -invalid.js:27:16 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 25 │ let x = "\8\\1\9" - 26 │ let x = "\9\\n9\\\9\9" - > 27 │ let x = "\8\\\\\9" - │ ^^ - 28 │ let x = "var foo = '\8'; bar('\9')" - 29 │ let x = "var foo = '8'\n bar = '\9'" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \9 with \\9 to include the actual backslash character. - - 27 │ let·x·=·"\8\\\\\\9" - │ + - -``` - ``` invalid.js:28:21 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -1555,48 +781,6 @@ invalid.js:28:21 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:28:21 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 26 │ let x = "\9\\n9\\\9\9" - 27 │ let x = "\8\\\\\9" - > 28 │ let x = "var foo = '\8'; bar('\9')" - │ ^^ - 29 │ let x = "var foo = '8'\n bar = '\9'" - 30 │ let x = "\\\n\8" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 28 │ let·x·=·"var·foo·=·'\\8';·bar('\9')" - │ + - -``` - -``` -invalid.js:28:31 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 26 │ let x = "\9\\n9\\\9\9" - 27 │ let x = "\8\\\\\9" - > 28 │ let x = "var foo = '\8'; bar('\9')" - │ ^^ - 29 │ let x = "var foo = '8'\n bar = '\9'" - 30 │ let x = "\\\n\8" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \9 with \\9 to include the actual backslash character. - - 28 │ let·x·=·"var·foo·=·'\8';·bar('\\9')" - │ + - -``` - ``` invalid.js:28:31 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -1639,27 +823,6 @@ invalid.js:29:34 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:29:34 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 27 │ let x = "\8\\\\\9" - 28 │ let x = "var foo = '\8'; bar('\9')" - > 29 │ let x = "var foo = '8'\n bar = '\9'" - │ ^^ - 30 │ let x = "\\\n\8" - 31 │ let x = "\\\r\n\9" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \9 with \\9 to include the actual backslash character. - - 29 │ let·x·=·"var·foo·=·'8'\n··bar·=·'\\9'" - │ + - -``` - ``` invalid.js:30:14 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -1686,27 +849,6 @@ invalid.js:30:14 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:30:14 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 28 │ let x = "var foo = '\8'; bar('\9')" - 29 │ let x = "var foo = '8'\n bar = '\9'" - > 30 │ let x = "\\\n\8" - │ ^^ - 31 │ let x = "\\\r\n\9" - 32 │ let x = "\\\\\n\8" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 30 │ let·x·=·"\\\n\\8" - │ + - -``` - ``` invalid.js:31:16 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -1733,27 +875,6 @@ invalid.js:31:16 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:31:16 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 29 │ let x = "var foo = '8'\n bar = '\9'" - 30 │ let x = "\\\n\8" - > 31 │ let x = "\\\r\n\9" - │ ^^ - 32 │ let x = "\\\\\n\8" - 33 │ let x = "foo\\\nbar\9baz" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \9 with \\9 to include the actual backslash character. - - 31 │ let·x·=·"\\\r\n\\9" - │ + - -``` - ``` invalid.js:32:16 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -1770,34 +891,13 @@ invalid.js:32:16 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ i Suggested fix: Replace \8 with 8. This maintains the current functionality. - 30 30 │ let x = "\\\n\8" - 31 31 │ let x = "\\\r\n\9" - 32 │ - let·x·=·"\\\\\n\8" - 32 │ + let·x·=·"\\\\\n8" - 33 33 │ let x = "foo\\\nbar\9baz" - 34 34 │ let x = "\\0\8" - - -``` - -``` -invalid.js:32:16 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 30 │ let x = "\\\n\8" - 31 │ let x = "\\\r\n\9" - > 32 │ let x = "\\\\\n\8" - │ ^^ - 33 │ let x = "foo\\\nbar\9baz" - 34 │ let x = "\\0\8" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. + 30 30 │ let x = "\\\n\8" + 31 31 │ let x = "\\\r\n\9" + 32 │ - let·x·=·"\\\\\n\8" + 32 │ + let·x·=·"\\\\\n8" + 33 33 │ let x = "foo\\\nbar\9baz" + 34 34 │ let x = "\\0\8" - 32 │ let·x·=·"\\\\\n\\8" - │ + ``` @@ -1827,27 +927,6 @@ invalid.js:33:20 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:33:20 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 31 │ let x = "\\\r\n\9" - 32 │ let x = "\\\\\n\8" - > 33 │ let x = "foo\\\nbar\9baz" - │ ^^ - 34 │ let x = "\\0\8" - 35 │ let x = "foo\\0\9bar" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \9 with \\9 to include the actual backslash character. - - 33 │ let·x·=·"foo\\\nbar\\9baz" - │ + - -``` - ``` invalid.js:34:11 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -1900,27 +979,6 @@ invalid.js:34:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:34:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 32 │ let x = "\\\\\n\8" - 33 │ let x = "foo\\\nbar\9baz" - > 34 │ let x = "\\0\8" - │ ^^ - 35 │ let x = "foo\\0\9bar" - 36 │ let x = "\\1\\0\8" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 34 │ let·x·=·"\\0\\8" - │ + - -``` - ``` invalid.js:35:14 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -1973,27 +1031,6 @@ invalid.js:35:16 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:35:16 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 33 │ let x = "foo\\\nbar\9baz" - 34 │ let x = "\\0\8" - > 35 │ let x = "foo\\0\9bar" - │ ^^ - 36 │ let x = "\\1\\0\8" - 37 │ let x = "\\0\8\9" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \9 with \\9 to include the actual backslash character. - - 35 │ let·x·=·"foo\\0\\9bar" - │ + - -``` - ``` invalid.js:36:14 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -2046,27 +1083,6 @@ invalid.js:36:16 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:36:16 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 34 │ let x = "\\0\8" - 35 │ let x = "foo\\0\9bar" - > 36 │ let x = "\\1\\0\8" - │ ^^ - 37 │ let x = "\\0\8\9" - 38 │ let x = "\8\\0\9" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 36 │ let·x·=·"\\1\\0\\8" - │ + - -``` - ``` invalid.js:37:11 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -2093,27 +1109,6 @@ invalid.js:37:11 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:37:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 35 │ let x = "foo\\0\9bar" - 36 │ let x = "\\1\\0\8" - > 37 │ let x = "\\0\8\9" - │ ^^ - 38 │ let x = "\8\\0\9" - 39 │ let x = "0\8" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 37 │ let·x·=·"\\0\\8\9" - │ + - -``` - ``` invalid.js:37:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -2140,27 +1135,6 @@ invalid.js:37:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:37:15 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 35 │ let x = "foo\\0\9bar" - 36 │ let x = "\\1\\0\8" - > 37 │ let x = "\\0\8\9" - │ ^^ - 38 │ let x = "\8\\0\9" - 39 │ let x = "0\8" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \9 with \\9 to include the actual backslash character. - - 37 │ let·x·=·"\\0\8\\9" - │ + - -``` - ``` invalid.js:38:10 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -2182,27 +1156,6 @@ invalid.js:38:10 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:38:10 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 36 │ let x = "\\1\\0\8" - 37 │ let x = "\\0\8\9" - > 38 │ let x = "\8\\0\9" - │ ^^ - 39 │ let x = "0\8" - 40 │ let x = "\\0\8" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 38 │ let·x·=·"\\8\\0\9" - │ + - -``` - ``` invalid.js:38:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -2255,27 +1208,6 @@ invalid.js:38:15 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:38:15 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 36 │ let x = "\\1\\0\8" - 37 │ let x = "\\0\8\9" - > 38 │ let x = "\8\\0\9" - │ ^^ - 39 │ let x = "0\8" - 40 │ let x = "\\0\8" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \9 with \\9 to include the actual backslash character. - - 38 │ let·x·=·"\8\\0\\9" - │ + - -``` - ``` invalid.js:39:11 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -2302,27 +1234,6 @@ invalid.js:39:11 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:39:11 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 37 │ let x = "\\0\8\9" - 38 │ let x = "\8\\0\9" - > 39 │ let x = "0\8" - │ ^^ - 40 │ let x = "\\0\8" - 41 │ let x = "\0 \8" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 39 │ let·x·=·"0\\8" - │ + - -``` - ``` invalid.js:40:11 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -2375,27 +1286,6 @@ invalid.js:40:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:40:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 38 │ let x = "\8\\0\9" - 39 │ let x = "0\8" - > 40 │ let x = "\\0\8" - │ ^^ - 41 │ let x = "\0 \8" - 42 │ let x = "\01\8" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 40 │ let·x·=·"\\0\\8" - │ + - -``` - ``` invalid.js:41:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -2417,27 +1307,6 @@ invalid.js:41:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:41:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 39 │ let x = "0\8" - 40 │ let x = "\\0\8" - > 41 │ let x = "\0 \8" - │ ^^ - 42 │ let x = "\01\8" - 43 │ let x = "\0\1\8" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 41 │ let·x·=·"\0·\\8" - │ + - -``` - ``` invalid.js:42:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -2464,27 +1333,6 @@ invalid.js:42:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:42:13 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 40 │ let x = "\\0\8" - 41 │ let x = "\0 \8" - > 42 │ let x = "\01\8" - │ ^^ - 43 │ let x = "\0\1\8" - 44 │ let x = "\0\\n\8" - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 42 │ let·x·=·"\01\\8" - │ + - -``` - ``` invalid.js:43:14 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -2511,27 +1359,6 @@ invalid.js:43:14 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:43:14 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 41 │ let x = "\0 \8" - 42 │ let x = "\01\8" - > 43 │ let x = "\0\1\8" - │ ^^ - 44 │ let x = "\0\\n\8" - 45 │ - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 43 │ let·x·=·"\0\1\\8" - │ + - -``` - ``` invalid.js:44:15 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -2556,24 +1383,4 @@ invalid.js:44:15 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━ ``` -``` -invalid.js:44:15 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ! Don't use `\8` and `\9` escape sequences in string literals. - - 42 │ let x = "\01\8" - 43 │ let x = "\0\1\8" - > 44 │ let x = "\0\\n\8" - │ ^^ - 45 │ - - i The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - i Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 44 │ let·x·=·"\0\\n\\8" - │ + - -``` - From 23937a0cd7750067fafec8fdd3ae705df67e3b4d Mon Sep 17 00:00:00 2001 From: unvalley Date: Fri, 7 Jul 2023 02:48:39 +0900 Subject: [PATCH 2/3] chore: remove invalid case from docuemnt example for cargo lintdoc chore: docs --- .../nursery/no_nonoctal_decimal_escape.rs | 8 -- .../lint/rules/noNonoctalDecimalEscape.md | 84 ------------------- 2 files changed, 92 deletions(-) diff --git a/crates/rome_js_analyze/src/analyzers/nursery/no_nonoctal_decimal_escape.rs b/crates/rome_js_analyze/src/analyzers/nursery/no_nonoctal_decimal_escape.rs index fc51d3936cb..8c396496a08 100644 --- a/crates/rome_js_analyze/src/analyzers/nursery/no_nonoctal_decimal_escape.rs +++ b/crates/rome_js_analyze/src/analyzers/nursery/no_nonoctal_decimal_escape.rs @@ -41,10 +41,6 @@ declare_rule! { /// const x = "Don't use \9 escape."; /// ``` /// - /// ```js,expect_diagnostic - /// const x = "\0\8"; - /// ``` - /// /// ## Valid /// /// ```js @@ -55,10 +51,6 @@ declare_rule! { /// const x = "Don't use \\8 and \\9 escapes."; /// ``` /// - /// ```js - /// const x = "\0\u0038";; - /// ``` - /// pub(crate) NoNonoctalDecimalEscape { version: "next", name: "noNonoctalDecimalEscape", diff --git a/website/src/pages/lint/rules/noNonoctalDecimalEscape.md b/website/src/pages/lint/rules/noNonoctalDecimalEscape.md index 5d6ec3efe34..79c2a473a7d 100644 --- a/website/src/pages/lint/rules/noNonoctalDecimalEscape.md +++ b/website/src/pages/lint/rules/noNonoctalDecimalEscape.md @@ -44,20 +44,6 @@ const x = "\8"; 1 │ const·x·=·"\8"; - -nursery/noNonoctalDecimalEscape.js:1:12 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━ - - Don't use `\8` and `\9` escape sequences in string literals. - - > 1 │ const x = "\8"; - ^^ - 2 │ - - The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 1 │ const·x·=·"\\8"; - + ```jsx @@ -78,20 +64,6 @@ const x = "Don't use \8 escape."; 1 │ const·x·=·"Don't·use·\8·escape."; - -nursery/noNonoctalDecimalEscape.js:1:22 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━ - - Don't use `\8` and `\9` escape sequences in string literals. - - > 1 │ const x = "Don't use \8 escape."; - ^^ - 2 │ - - The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - Suggested fix: Replace \8 with \\8 to include the actual backslash character. - - 1 │ const·x·=·"Don't·use·\\8·escape."; - + ```jsx @@ -112,58 +84,6 @@ const x = "Don't use \9 escape."; 1 │ const·x·=·"Don't·use·\9·escape."; - -nursery/noNonoctalDecimalEscape.js:1:22 lint/nursery/noNonoctalDecimalEscape FIXABLE ━━━━━━━━━━━━━ - - Don't use `\8` and `\9` escape sequences in string literals. - - > 1 │ const x = "Don't use \9 escape."; - ^^ - 2 │ - - The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used. - - Suggested fix: Replace \9 with \\9 to include the actual backslash character. - - 1 │ const·x·=·"Don't·use·\\9·escape."; - + - - -```jsx -const x = "\0\8"; -``` - -
nursery/noNonoctalDecimalEscape.js:1:12 lint/nursery/noNonoctalDecimalEscape  FIXABLE  ━━━━━━━━━━━━━
-
-   Don't use `\8` and `\9` escape sequences in string literals.
-  
-  > 1 │ const x = "\0\8";
-              ^^^^
-    2 │ 
-  
-   The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used.
-  
-   Suggested fix: Replace \0\8 with \u00008. This maintains the current functionality.
-  
-    1  - const·x·=·"\0\8";
-      1+ const·x·=·"\u00008";
-    2 2  
-  
-nursery/noNonoctalDecimalEscape.js:1:14 lint/nursery/noNonoctalDecimalEscape  FIXABLE  ━━━━━━━━━━━━━
-
-   Don't use `\8` and `\9` escape sequences in string literals.
-  
-  > 1 │ const x = "\0\8";
-                ^^
-    2 │ 
-  
-   The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used.
-  
-   Suggested fix: Replace \8 with \u0038. This maintains the current functionality.
-  
-    1  - const·x·=·"\0\8";
-      1+ const·x·=·"\0\u0038";
-    2 2  
-  
 
## Valid @@ -176,10 +96,6 @@ const x = "8"; const x = "Don't use \\8 and \\9 escapes."; ``` -```jsx -const x = "\0\u0038";; -``` - ## Related links - [Disable a rule](/linter/#disable-a-lint-rule) From 90188d0e374f1f4fa12e215f83423cdb67c18fb5 Mon Sep 17 00:00:00 2001 From: unvalley Date: Fri, 7 Jul 2023 03:11:02 +0900 Subject: [PATCH 3/3] refactor: remove BackslashEscape --- .../analyzers/nursery/no_nonoctal_decimal_escape.rs | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/crates/rome_js_analyze/src/analyzers/nursery/no_nonoctal_decimal_escape.rs b/crates/rome_js_analyze/src/analyzers/nursery/no_nonoctal_decimal_escape.rs index 8c396496a08..456eba49db3 100644 --- a/crates/rome_js_analyze/src/analyzers/nursery/no_nonoctal_decimal_escape.rs +++ b/crates/rome_js_analyze/src/analyzers/nursery/no_nonoctal_decimal_escape.rs @@ -61,7 +61,6 @@ declare_rule! { #[derive(Debug)] pub(crate) enum FixSuggestionKind { Refactor, - // EscapeBackslash, } #[derive(Debug)] @@ -148,14 +147,6 @@ impl Rule for NoNonoctalDecimalEscape { replace_string_range: replace_string_range.clone(), }) } - // \8 -> \\8 - // signals.push(RuleState { - // kind: FixSuggestionKind::EscapeBackslash, - // diagnostics_text_range: decimal_escape_range, - // replace_to: format!("\\{}", decimal_escape), - // replace_from: decimal_escape.to_string(), - // replace_string_range, - // }); } } @@ -214,9 +205,6 @@ impl Rule for NoNonoctalDecimalEscape { FixSuggestionKind::Refactor => { markup! ("Replace "{replace_from}" with "{replace_to}". This maintains the current functionality.").to_owned() } - // FixSuggestionKind::EscapeBackslash => { - // markup! ("Replace "{replace_from}" with "{replace_to}" to include the actual backslash character." ).to_owned() - // } }, mutation, })