@@ -35,7 +35,7 @@ Examples of **incorrect** code for this rule with the default `{ "properties": "
3535
3636import { no_camelcased } from " external-module"
3737
38- var my_favorite_color = " #112C85" ;
38+ const my_favorite_color = " #112C85" ;
3939
4040function do_something () {
4141 // ...
@@ -57,15 +57,15 @@ function baz({ no_camelcased = 'default value' }) {
5757 // ...
5858};
5959
60- var obj = {
60+ const obj = {
6161 my_pref: 1
6262};
6363
64- var { category_id = 1 } = query;
64+ const { category_id = 1 } = query;
6565
66- var { foo: snake_cased } = bar;
66+ const { foo: snake_cased } = bar;
6767
68- var { foo: bar_baz = 1 } = quz;
68+ const { foo: bar_baz = 1 } = quz;
6969```
7070
7171:::
@@ -79,18 +79,18 @@ Examples of **correct** code for this rule with the default `{ "properties": "al
7979
8080import { no_camelcased as camelCased } from " external-module" ;
8181
82- var myFavoriteColor = " #112C85" ;
83- var _myFavoriteColor = " #112C85" ;
84- var myFavoriteColor_ = " #112C85" ;
85- var MY_FAVORITE_COLOR = " #112C85" ;
86- var foo1 = bar .baz_boom ;
87- var foo2 = { qux: bar .baz_boom };
82+ const myFavoriteColor = " #112C85" ;
83+ const _myFavoriteColor = " #112C85" ;
84+ const myFavoriteColor_ = " #112C85" ;
85+ const MY_FAVORITE_COLOR = " #112C85" ;
86+ const foo1 = bar .baz_boom ;
87+ const foo2 = { qux: bar .baz_boom };
8888
8989obj .do_something ();
9090do_something ();
9191new do_something ();
9292
93- var { category_id: category } = query;
93+ const { category_id: category } = query;
9494
9595function foo ({ isCamelCased }) {
9696 // ...
@@ -104,11 +104,11 @@ function baz({ isCamelCased = 'default value' }) {
104104 // ...
105105};
106106
107- var { categoryId = 1 } = query;
107+ const { categoryId = 1 } = query;
108108
109- var { foo: isCamelCased } = bar;
109+ const { foo: isCamelCased } = bar;
110110
111- var { foo: isCamelCased = 1 } = quz;
111+ const { foo: camelCasedName = 1 } = quz;
112112
113113```
114114
@@ -123,7 +123,7 @@ Examples of **correct** code for this rule with the `{ "properties": "never" }`
123123``` js
124124/* eslint camelcase: ["error", {properties: "never"}]*/
125125
126- var obj = {
126+ const obj = {
127127 my_pref: 1
128128};
129129
@@ -141,15 +141,15 @@ Examples of **incorrect** code for this rule with the default `{ "ignoreDestruct
141141``` js
142142/* eslint camelcase: "error"*/
143143
144- var { category_id } = query;
144+ const { category_id } = query;
145145
146- var { category_name = 1 } = query;
146+ const { category_name = 1 } = query;
147147
148- var { category_id: category_title } = query;
148+ const { category_id: category_title } = query;
149149
150- var { category_id: category_alias } = query;
150+ const { category_id: category_alias } = query;
151151
152- var { category_id: categoryId, ... other_props } = query;
152+ const { category_id: categoryId , ... other_props } = query;
153153```
154154
155155:::
@@ -163,9 +163,9 @@ Examples of **incorrect** code for this rule with the `{ "ignoreDestructuring":
163163``` js
164164/* eslint camelcase: ["error", {ignoreDestructuring: true}]*/
165165
166- var { category_id: category_alias } = query;
166+ const { category_id: category_alias } = query;
167167
168- var { category_id, ... other_props } = query;
168+ const { category_id , ... other_props } = query;
169169```
170170
171171:::
@@ -177,11 +177,11 @@ Examples of **correct** code for this rule with the `{ "ignoreDestructuring": tr
177177``` js
178178/* eslint camelcase: ["error", {ignoreDestructuring: true}]*/
179179
180- var { category_id } = query;
180+ const { category_id } = query;
181181
182- var { category_id = 1 } = query;
182+ const { category_name = 1 } = query;
183183
184- var { category_id : category_id } = query;
184+ const { category_id_name : category_id_name } = query;
185185```
186186
187187:::
@@ -195,8 +195,8 @@ Examples of additional **incorrect** code for this rule with the `{ "ignoreDestr
195195``` js
196196/* eslint camelcase: ["error", {ignoreDestructuring: true}]*/
197197
198- var { some_property } = obj; // allowed by {ignoreDestructuring: true}
199- var foo = some_property + 1 ; // error, ignoreDestructuring does not apply to this statement
198+ const { some_property } = obj; // allowed by {ignoreDestructuring: true}
199+ const foo = some_property + 1 ; // error, ignoreDestructuring does not apply to this statement
200200```
201201
202202:::
@@ -210,7 +210,7 @@ Examples of additional **correct** code for this rule with the `{ "ignoreDestruc
210210``` js
211211/* eslint camelcase: ["error", {ignoreDestructuring: true}]*/
212212
213- var { some_property, ... rest } = obj;
213+ const { some_property , ... rest } = obj;
214214// do something with 'rest', nothing with 'some_property'
215215```
216216
@@ -225,7 +225,7 @@ Examples of additional **correct** code for this rule with the `{ "properties":
225225``` js
226226/* eslint camelcase: ["error", {"properties": "never", ignoreDestructuring: true}]*/
227227
228- var { some_property } = obj;
228+ const { some_property } = obj;
229229doSomething ({ some_property });
230230```
231231
0 commit comments