--- source: crates/biome_js_analyze/tests/spec_tests.rs expression: invalid.js --- # Input ```jsx let { /*before*/ foo: foo /*after*/ } = obj; let { a, foo: foo } = obj; let { foo: foo, b } = obj; let { foo: { bar: bar }, } = obj; let { /*before*/ foo: foo /*after*/ = /*before default*/ a /*after default*/ } = obj; function f({ foo: foo }) {} ({ foo: foo }) => {}; import { /*before*/ foo as foo /*after*/ } from "foo"; import { a as a } from "foo"; export { /*before*/ foo as foo /*after*/ }; export { /*before*/ foo as foo /*after*/ } from "foo"; // following cases are supported by ESLint //import {a as \u0061} from 'foo'; //import {\u0061 as a} from 'foo'; //export {\u0061 as a}; //export {a as \u0061}; //let {"a": a} = obj; //import { "a" as a} //export { a as "a"} ``` # Diagnostics ``` invalid.js:1:18 lint/complexity/noUselessRename FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Useless rename. > 1 │ let { /*before*/ foo: foo /*after*/ } = obj; │ ^^^^^^^^ 2 │ 3 │ let { a, foo: foo } = obj; i Safe fix: Remove the renaming. 1 │ let·{·/*before*/·foo:·foo·/*after*/·}·=·obj; │ ----- ``` ``` invalid.js:3:10 lint/complexity/noUselessRename FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Useless rename. 1 │ let { /*before*/ foo: foo /*after*/ } = obj; 2 │ > 3 │ let { a, foo: foo } = obj; │ ^^^^^^^^ 4 │ 5 │ let { foo: foo, b } = obj; i Safe fix: Remove the renaming. 3 │ let·{·a,·foo:·foo·}·=·obj; │ ----- ``` ``` invalid.js:5:7 lint/complexity/noUselessRename FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Useless rename. 3 │ let { a, foo: foo } = obj; 4 │ > 5 │ let { foo: foo, b } = obj; │ ^^^^^^^^ 6 │ 7 │ let { i Safe fix: Remove the renaming. 5 │ let·{·foo:·foo,·b·}·=·obj; │ ----- ``` ``` invalid.js:8:9 lint/complexity/noUselessRename FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Useless rename. 7 │ let { > 8 │ foo: { bar: bar }, │ ^^^^^^^^ 9 │ } = obj; 10 │ i Safe fix: Remove the renaming. 8 │ → foo:·{·bar:·bar·}, │ ----- ``` ``` invalid.js:11:18 lint/complexity/noUselessRename FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Useless rename. 9 │ } = obj; 10 │ > 11 │ let { /*before*/ foo: foo /*after*/ = /*before default*/ a /*after default*/ } = │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 12 │ obj; 13 │ i Safe fix: Remove the renaming. 11 │ let·{·/*before*/·foo:·foo·/*after*/·=·/*before·default*/·a·/*after·default*/·}·= │ ----- ``` ``` invalid.js:14:14 lint/complexity/noUselessRename FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Useless rename. 12 │ obj; 13 │ > 14 │ function f({ foo: foo }) {} │ ^^^^^^^^ 15 │ 16 │ ({ foo: foo }) => {}; i Safe fix: Remove the renaming. 14 │ function·f({·foo:·foo·})·{} │ ----- ``` ``` invalid.js:16:4 lint/complexity/noUselessRename FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Useless rename. 14 │ function f({ foo: foo }) {} 15 │ > 16 │ ({ foo: foo }) => {}; │ ^^^^^^^^ 17 │ 18 │ import { /*before*/ foo as foo /*after*/ } from "foo"; i Safe fix: Remove the renaming. 16 │ ({·foo:·foo·})·=>·{}; │ ----- ``` ``` invalid.js:18:21 lint/complexity/noUselessRename FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Useless rename. 16 │ ({ foo: foo }) => {}; 17 │ > 18 │ import { /*before*/ foo as foo /*after*/ } from "foo"; │ ^^^^^^^^^^ 19 │ 20 │ import { a as a } from "foo"; i Safe fix: Remove the renaming. 18 │ import·{·/*before*/·foo·as·foo·/*after*/·}·from·"foo"; │ ------- ``` ``` invalid.js:20:10 lint/complexity/noUselessRename FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Useless rename. 18 │ import { /*before*/ foo as foo /*after*/ } from "foo"; 19 │ > 20 │ import { a as a } from "foo"; │ ^^^^^^ 21 │ 22 │ export { /*before*/ foo as foo /*after*/ }; i Safe fix: Remove the renaming. 20 │ import·{·a·as·a·}·from·"foo"; │ ----- ``` ``` invalid.js:22:21 lint/complexity/noUselessRename FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Useless rename. 20 │ import { a as a } from "foo"; 21 │ > 22 │ export { /*before*/ foo as foo /*after*/ }; │ ^^^^^^^^^^ 23 │ 24 │ export { /*before*/ foo as foo /*after*/ } from "foo"; i Safe fix: Remove the renaming. 22 │ export·{·/*before*/·foo·as·foo·/*after*/·}; │ ------- ``` ``` invalid.js:24:21 lint/complexity/noUselessRename FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Useless rename. 22 │ export { /*before*/ foo as foo /*after*/ }; 23 │ > 24 │ export { /*before*/ foo as foo /*after*/ } from "foo"; │ ^^^^^^^^^^ 25 │ 26 │ // following cases are supported by ESLint i Safe fix: Remove the renaming. 24 │ export·{·/*before*/·foo·as·foo·/*after*/·}·from·"foo"; │ ------- ```