From cb44826f0269b338a50b806c97266b62678803f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduard=20Lavu=C5=A1?= Date: Sat, 6 Jan 2024 11:30:13 +0100 Subject: [PATCH] chore: update snapshot tests --- .../style/useNumericLiterals/invalid.js.snap | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/crates/biome_js_analyze/tests/specs/style/useNumericLiterals/invalid.js.snap b/crates/biome_js_analyze/tests/specs/style/useNumericLiterals/invalid.js.snap index 9d0681d8bb21..c117f484d1c8 100644 --- a/crates/biome_js_analyze/tests/specs/style/useNumericLiterals/invalid.js.snap +++ b/crates/biome_js_analyze/tests/specs/style/useNumericLiterals/invalid.js.snap @@ -1,5 +1,6 @@ --- source: crates/biome_js_analyze/tests/spec_tests.rs +assertion_line: 83 expression: invalid.js --- # Input @@ -1449,6 +1450,32 @@ invalid.js:59:1 lint/style/useNumericLiterals FIXABLE ━━━━━━━━ 61 61 │ parseInt('11', 2)//comment +``` + +``` +invalid.js:60:1 lint/style/useNumericLiterals FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + ! This call to parseInt() can be replaced by a binary literal. + + 58 │ parseInt('11'/**/, 2); + 59 │ parseInt(`11`/**/, 2); + > 60 │ parseInt('11', 2 /**/); + │ ^^^^^^^^^^^^^^^^^^^^^^ + 61 │ parseInt('11', 2)//comment + 62 │ ; + + i Using a literal avoids unnecessary computations. + + i Unsafe fix: Use the computed binary literal instead. + + 58 58 │ parseInt('11'/**/, 2); + 59 59 │ parseInt(`11`/**/, 2); + 60 │ - parseInt('11',·2·/**/); + 60 │ + 0b11; + 61 61 │ parseInt('11', 2)//comment + 62 62 │ ; + + ``` ```