Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf3aeefb

Browse files
docs: rewrite using let and const in rule examples (#19320)
* docs: rewrite var using let and const* docs: rewrite examples using let and const* docs: rewrite var using let and const* Update docs/src/rules/accessor-pairs.mdCo-authored-by: Amaresh S M <amareshsm13@gmail.com>* Update docs/src/rules/accessor-pairs.mdCo-authored-by: Amaresh S M <amareshsm13@gmail.com>* docs: rewrite using const* Update accessor-pairs.md* Update accessor-pairs.md* Update let variables to const---------Co-authored-by: Amaresh S M <amareshsm13@gmail.com>
1 parent0b680b3 commitf3aeefb

File tree

2 files changed

+82
-82
lines changed

2 files changed

+82
-82
lines changed

‎docs/src/rules/accessor-pairs.md‎

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ Here are some examples:
1717

1818
```js
1919
// Bad
20-
var o= {
20+
consto= {
2121
seta(value) {
2222
this.val= value;
2323
}
2424
};
2525

2626

2727
// Good
28-
var o= {
28+
constp= {
2929
seta(value) {
3030
this.val= value;
3131
},
@@ -61,15 +61,15 @@ Examples of **incorrect** code for the default `{ "setWithoutGet": true }` optio
6161
```js
6262
/*eslint accessor-pairs: "error"*/
6363

64-
var o= {
64+
constq= {
6565
seta(value) {
6666
this.val= value;
6767
}
6868
};
6969

7070

71-
var o= {d:1};
72-
Object.defineProperty(o,'c', {
71+
constr= {d:1};
72+
Object.defineProperty(r,'c', {
7373
set:function(value) {
7474
this.val= value;
7575
}
@@ -85,7 +85,7 @@ Examples of **correct** code for the default `{ "setWithoutGet": true }` option:
8585
```js
8686
/*eslint accessor-pairs: "error"*/
8787

88-
var o= {
88+
consts= {
8989
seta(value) {
9090
this.val= value;
9191
},
@@ -94,8 +94,8 @@ var o = {
9494
}
9595
};
9696

97-
var o= {d:1};
98-
Object.defineProperty(o,'c', {
97+
constt= {d:1};
98+
Object.defineProperty(t,'c', {
9999
set:function(value) {
100100
this.val= value;
101101
},
@@ -117,27 +117,27 @@ Examples of **incorrect** code for the `{ "getWithoutSet": true }` option:
117117
```js
118118
/*eslint accessor-pairs: ["error", { "getWithoutSet": true }]*/
119119

120-
var o= {
120+
constu= {
121121
seta(value) {
122122
this.val= value;
123123
}
124124
};
125125

126-
var o= {
126+
constv= {
127127
geta() {
128128
returnthis.val;
129129
}
130130
};
131131

132-
var o= {d:1};
133-
Object.defineProperty(o,'c', {
132+
constw= {d:1};
133+
Object.defineProperty(w,'c', {
134134
set:function(value) {
135135
this.val= value;
136136
}
137137
});
138138

139-
var o= {d:1};
140-
Object.defineProperty(o,'c', {
139+
constx= {d:1};
140+
Object.defineProperty(x,'c', {
141141
get:function() {
142142
returnthis.val;
143143
}
@@ -152,7 +152,7 @@ Examples of **correct** code for the `{ "getWithoutSet": true }` option:
152152

153153
```js
154154
/*eslint accessor-pairs: ["error", { "getWithoutSet": true }]*/
155-
var o= {
155+
consty= {
156156
seta(value) {
157157
this.val= value;
158158
},
@@ -161,8 +161,8 @@ var o = {
161161
}
162162
};
163163

164-
var o= {d:1};
165-
Object.defineProperty(o,'c', {
164+
constz= {d:1};
165+
Object.defineProperty(z,'c', {
166166
set:function(value) {
167167
this.val= value;
168168
},
@@ -281,14 +281,14 @@ might not report a missing pair for a getter/setter that has a computed key, lik
281281
```js
282282
/*eslint accessor-pairs: "error"*/
283283

284-
var a=1;
284+
constz=1;
285285

286286
// no warnings
287-
var o= {
288-
get [a++]() {
287+
consta= {
288+
get [z++]() {
289289
returnthis.val;
290290
},
291-
set [a++](value) {
291+
set [z++](value) {
292292
this.val= value;
293293
}
294294
};
@@ -301,7 +301,7 @@ might not report a missing pair for a getter/setter, like in the following examp
301301
/*eslint accessor-pairs: "error"*/
302302

303303
// no warnings
304-
var o= {
304+
constb= {
305305
geta() {
306306
returnthis.val;
307307
},

‎docs/src/rules/array-bracket-newline.md‎

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ Examples of **incorrect** code for this rule with the `"always"` option:
3535
```js
3636
/*eslint array-bracket-newline: ["error", "always"]*/
3737

38-
var a= [];
39-
var b= [1];
40-
var c= [1,2];
41-
var d= [1,
38+
consta= [];
39+
constb= [1];
40+
constc= [1,2];
41+
constd= [1,
4242
2];
43-
var e= [functionfoo() {
43+
conste= [functionfoo() {
4444
dosomething();
4545
}];
4646
```
@@ -54,19 +54,19 @@ Examples of **correct** code for this rule with the `"always"` option:
5454
```js
5555
/*eslint array-bracket-newline: ["error", "always"]*/
5656

57-
var a= [
57+
consta= [
5858
];
59-
var b= [
59+
constb= [
6060
1
6161
];
62-
var c= [
62+
constc= [
6363
1,2
6464
];
65-
var d= [
65+
constd= [
6666
1,
6767
2
6868
];
69-
var e= [
69+
conste= [
7070
functionfoo() {
7171
dosomething();
7272
}
@@ -84,19 +84,19 @@ Examples of **incorrect** code for this rule with the `"never"` option:
8484
```js
8585
/*eslint array-bracket-newline: ["error", "never"]*/
8686

87-
var a= [
87+
consta= [
8888
];
89-
var b= [
89+
constb= [
9090
1
9191
];
92-
var c= [
92+
constc= [
9393
1,2
9494
];
95-
var d= [
95+
constd= [
9696
1,
9797
2
9898
];
99-
var e= [
99+
conste= [
100100
functionfoo() {
101101
dosomething();
102102
}
@@ -112,12 +112,12 @@ Examples of **correct** code for this rule with the `"never"` option:
112112
```js
113113
/*eslint array-bracket-newline: ["error", "never"]*/
114114

115-
var a= [];
116-
var b= [1];
117-
var c= [1,2];
118-
var d= [1,
115+
consta= [];
116+
constb= [1];
117+
constc= [1,2];
118+
constd= [1,
119119
2];
120-
var e= [functionfoo() {
120+
conste= [functionfoo() {
121121
dosomething();
122122
}];
123123
```
@@ -133,15 +133,15 @@ Examples of **incorrect** code for this rule with the `"consistent"` option:
133133
```js
134134
/*eslint array-bracket-newline: ["error", "consistent"]*/
135135

136-
var a= [1
136+
consta= [1
137137
];
138-
var b= [
138+
constb= [
139139
1];
140-
var c= [functionfoo() {
140+
constc= [functionfoo() {
141141
dosomething();
142142
}
143143
]
144-
var d= [
144+
constd= [
145145
functionfoo() {
146146
dosomething();
147147
}]
@@ -156,17 +156,17 @@ Examples of **correct** code for this rule with the `"consistent"` option:
156156
```js
157157
/*eslint array-bracket-newline: ["error", "consistent"]*/
158158

159-
var a= [];
160-
var b= [
159+
consta= [];
160+
constb= [
161161
];
162-
var c= [1];
163-
var d= [
162+
constc= [1];
163+
constd= [
164164
1
165165
];
166-
var e= [functionfoo() {
166+
conste= [functionfoo() {
167167
dosomething();
168168
}];
169-
var f= [
169+
constf= [
170170
functionfoo() {
171171
dosomething();
172172
}
@@ -184,17 +184,17 @@ Examples of **incorrect** code for this rule with the default `{ "multiline": tr
184184
```js
185185
/*eslint array-bracket-newline: ["error", { "multiline": true }]*/
186186

187-
var a= [
187+
consta= [
188188
];
189-
var b= [
189+
constb= [
190190
1
191191
];
192-
var c= [
192+
constc= [
193193
1,2
194194
];
195-
var d= [1,
195+
constd= [1,
196196
2];
197-
var e= [functionfoo() {
197+
conste= [functionfoo() {
198198
dosomething();
199199
}];
200200
```
@@ -208,14 +208,14 @@ Examples of **correct** code for this rule with the default `{ "multiline": true
208208
```js
209209
/*eslint array-bracket-newline: ["error", { "multiline": true }]*/
210210

211-
var a= [];
212-
var b= [1];
213-
var c= [1,2];
214-
var d= [
211+
consta= [];
212+
constb= [1];
213+
constc= [1,2];
214+
constd= [
215215
1,
216216
2
217217
];
218-
var e= [
218+
conste= [
219219
functionfoo() {
220220
dosomething();
221221
}
@@ -233,15 +233,15 @@ Examples of **incorrect** code for this rule with the `{ "minItems": 2 }` option
233233
```js
234234
/*eslint array-bracket-newline: ["error", { "minItems": 2 }]*/
235235

236-
var a= [
236+
consta= [
237237
];
238-
var b= [
238+
constb= [
239239
1
240240
];
241-
var c= [1,2];
242-
var d= [1,
241+
constc= [1,2];
242+
constd= [1,
243243
2];
244-
var e= [
244+
conste= [
245245
functionfoo() {
246246
dosomething();
247247
}
@@ -257,16 +257,16 @@ Examples of **correct** code for this rule with the `{ "minItems": 2 }` option:
257257
```js
258258
/*eslint array-bracket-newline: ["error", { "minItems": 2 }]*/
259259

260-
var a= [];
261-
var b= [1];
262-
var c= [
260+
consta= [];
261+
constb= [1];
262+
constc= [
263263
1,2
264264
];
265-
var d= [
265+
constd= [
266266
1,
267267
2
268268
];
269-
var e= [functionfoo() {
269+
conste= [functionfoo() {
270270
dosomething();
271271
}];
272272
```
@@ -282,15 +282,15 @@ Examples of **incorrect** code for this rule with the `{ "multiline": true, "min
282282
```js
283283
/*eslint array-bracket-newline: ["error", { "multiline": true, "minItems": 2 }]*/
284284

285-
var a= [
285+
consta= [
286286
];
287-
var b= [
287+
constb= [
288288
1
289289
];
290-
var c= [1,2];
291-
var d= [1,
290+
constc= [1,2];
291+
constd= [1,
292292
2];
293-
var e= [functionfoo() {
293+
conste= [functionfoo() {
294294
dosomething();
295295
}];
296296
```
@@ -304,16 +304,16 @@ Examples of **correct** code for this rule with the `{ "multiline": true, "minIt
304304
```js
305305
/*eslint array-bracket-newline: ["error", { "multiline": true, "minItems": 2 }]*/
306306

307-
var a= [];
308-
var b= [1];
309-
var c= [
307+
consta= [];
308+
constb= [1];
309+
constc= [
310310
1,2
311311
];
312-
var d= [
312+
constd= [
313313
1,
314314
2
315315
];
316-
var e= [
316+
conste= [
317317
functionfoo() {
318318
dosomething();
319319
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp