From 82002be3ab7dbd89fd7cb49a0adbd9fc56c3cfc2 Mon Sep 17 00:00:00 2001 From: PoloSpark Date: Mon, 6 Jan 2025 16:51:19 -0700 Subject: [PATCH 1/9] docs: rewrite var using let and const --- docs/src/rules/accessor-pairs.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/src/rules/accessor-pairs.md b/docs/src/rules/accessor-pairs.md index b84205d34935..4a8454b04a91 100644 --- a/docs/src/rules/accessor-pairs.md +++ b/docs/src/rules/accessor-pairs.md @@ -17,7 +17,7 @@ Here are some examples: ```js // Bad -var o = { +let o = { set a(value) { this.val = value; } @@ -25,7 +25,7 @@ var o = { // Good -var o = { +let o = { set a(value) { this.val = value; }, @@ -61,14 +61,14 @@ Examples of **incorrect** code for the default `{ "setWithoutGet": true }` optio ```js /*eslint accessor-pairs: "error"*/ -var o = { +let o = { set a(value) { this.val = value; } }; -var o = {d: 1}; +let o = {d: 1}; Object.defineProperty(o, 'c', { set: function(value) { this.val = value; @@ -85,7 +85,7 @@ Examples of **correct** code for the default `{ "setWithoutGet": true }` option: ```js /*eslint accessor-pairs: "error"*/ -var o = { +let o = { set a(value) { this.val = value; }, @@ -94,7 +94,7 @@ var o = { } }; -var o = {d: 1}; +let o = {d: 1}; Object.defineProperty(o, 'c', { set: function(value) { this.val = value; @@ -117,26 +117,26 @@ Examples of **incorrect** code for the `{ "getWithoutSet": true }` option: ```js /*eslint accessor-pairs: ["error", { "getWithoutSet": true }]*/ -var o = { +let o = { set a(value) { this.val = value; } }; -var o = { +let o = { get a() { return this.val; } }; -var o = {d: 1}; +let o = {d: 1}; Object.defineProperty(o, 'c', { set: function(value) { this.val = value; } }); -var o = {d: 1}; +let o = {d: 1}; Object.defineProperty(o, 'c', { get: function() { return this.val; @@ -152,7 +152,7 @@ Examples of **correct** code for the `{ "getWithoutSet": true }` option: ```js /*eslint accessor-pairs: ["error", { "getWithoutSet": true }]*/ -var o = { +let o = { set a(value) { this.val = value; }, @@ -161,7 +161,7 @@ var o = { } }; -var o = {d: 1}; +let o = {d: 1}; Object.defineProperty(o, 'c', { set: function(value) { this.val = value; @@ -281,10 +281,10 @@ might not report a missing pair for a getter/setter that has a computed key, lik ```js /*eslint accessor-pairs: "error"*/ -var a = 1; +let a = 1; // no warnings -var o = { +let o = { get [a++]() { return this.val; }, @@ -301,7 +301,7 @@ might not report a missing pair for a getter/setter, like in the following examp /*eslint accessor-pairs: "error"*/ // no warnings -var o = { +let o = { get a() { return this.val; }, From e1fc896c980b942bf7c25355cf42770ce5fe13a9 Mon Sep 17 00:00:00 2001 From: PoloSpark Date: Mon, 6 Jan 2025 16:57:17 -0700 Subject: [PATCH 2/9] docs: rewrite examples using let and const --- docs/src/rules/array-bracket-newline.md | 120 ++++++++++++------------ 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/docs/src/rules/array-bracket-newline.md b/docs/src/rules/array-bracket-newline.md index 900fea16fb09..88a68d5bc387 100644 --- a/docs/src/rules/array-bracket-newline.md +++ b/docs/src/rules/array-bracket-newline.md @@ -35,12 +35,12 @@ Examples of **incorrect** code for this rule with the `"always"` option: ```js /*eslint array-bracket-newline: ["error", "always"]*/ -var a = []; -var b = [1]; -var c = [1, 2]; -var d = [1, +let a = []; +let b = [1]; +let c = [1, 2]; +let d = [1, 2]; -var e = [function foo() { +let e = [function foo() { dosomething(); }]; ``` @@ -54,19 +54,19 @@ Examples of **correct** code for this rule with the `"always"` option: ```js /*eslint array-bracket-newline: ["error", "always"]*/ -var a = [ +let a = [ ]; -var b = [ +let b = [ 1 ]; -var c = [ +let c = [ 1, 2 ]; -var d = [ +let d = [ 1, 2 ]; -var e = [ +let e = [ function foo() { dosomething(); } @@ -84,19 +84,19 @@ Examples of **incorrect** code for this rule with the `"never"` option: ```js /*eslint array-bracket-newline: ["error", "never"]*/ -var a = [ +let a = [ ]; -var b = [ +let b = [ 1 ]; -var c = [ +let c = [ 1, 2 ]; -var d = [ +let d = [ 1, 2 ]; -var e = [ +let e = [ function foo() { dosomething(); } @@ -112,12 +112,12 @@ Examples of **correct** code for this rule with the `"never"` option: ```js /*eslint array-bracket-newline: ["error", "never"]*/ -var a = []; -var b = [1]; -var c = [1, 2]; -var d = [1, +let a = []; +let b = [1]; +let c = [1, 2]; +let d = [1, 2]; -var e = [function foo() { +let e = [function foo() { dosomething(); }]; ``` @@ -133,15 +133,15 @@ Examples of **incorrect** code for this rule with the `"consistent"` option: ```js /*eslint array-bracket-newline: ["error", "consistent"]*/ -var a = [1 +let a = [1 ]; -var b = [ +let b = [ 1]; -var c = [function foo() { +let c = [function foo() { dosomething(); } ] -var d = [ +let d = [ function foo() { dosomething(); }] @@ -156,17 +156,17 @@ Examples of **correct** code for this rule with the `"consistent"` option: ```js /*eslint array-bracket-newline: ["error", "consistent"]*/ -var a = []; -var b = [ +let a = []; +let b = [ ]; -var c = [1]; -var d = [ +let c = [1]; +let d = [ 1 ]; -var e = [function foo() { +let e = [function foo() { dosomething(); }]; -var f = [ +let f = [ function foo() { dosomething(); } @@ -184,17 +184,17 @@ Examples of **incorrect** code for this rule with the default `{ "multiline": tr ```js /*eslint array-bracket-newline: ["error", { "multiline": true }]*/ -var a = [ +let a = [ ]; -var b = [ +let b = [ 1 ]; -var c = [ +let c = [ 1, 2 ]; -var d = [1, +let d = [1, 2]; -var e = [function foo() { +let e = [function foo() { dosomething(); }]; ``` @@ -208,14 +208,14 @@ Examples of **correct** code for this rule with the default `{ "multiline": true ```js /*eslint array-bracket-newline: ["error", { "multiline": true }]*/ -var a = []; -var b = [1]; -var c = [1, 2]; -var d = [ +let a = []; +let b = [1]; +let c = [1, 2]; +let d = [ 1, 2 ]; -var e = [ +let e = [ function foo() { dosomething(); } @@ -233,15 +233,15 @@ Examples of **incorrect** code for this rule with the `{ "minItems": 2 }` option ```js /*eslint array-bracket-newline: ["error", { "minItems": 2 }]*/ -var a = [ +let a = [ ]; -var b = [ +let b = [ 1 ]; -var c = [1, 2]; -var d = [1, +let c = [1, 2]; +let d = [1, 2]; -var e = [ +let e = [ function foo() { dosomething(); } @@ -257,16 +257,16 @@ Examples of **correct** code for this rule with the `{ "minItems": 2 }` option: ```js /*eslint array-bracket-newline: ["error", { "minItems": 2 }]*/ -var a = []; -var b = [1]; -var c = [ +let a = []; +let b = [1]; +let c = [ 1, 2 ]; -var d = [ +let d = [ 1, 2 ]; -var e = [function foo() { +let e = [function foo() { dosomething(); }]; ``` @@ -282,15 +282,15 @@ Examples of **incorrect** code for this rule with the `{ "multiline": true, "min ```js /*eslint array-bracket-newline: ["error", { "multiline": true, "minItems": 2 }]*/ -var a = [ +let a = [ ]; -var b = [ +let b = [ 1 ]; -var c = [1, 2]; -var d = [1, +let c = [1, 2]; +let d = [1, 2]; -var e = [function foo() { +let e = [function foo() { dosomething(); }]; ``` @@ -304,16 +304,16 @@ Examples of **correct** code for this rule with the `{ "multiline": true, "minIt ```js /*eslint array-bracket-newline: ["error", { "multiline": true, "minItems": 2 }]*/ -var a = []; -var b = [1]; -var c = [ +let a = []; +let b = [1]; +let c = [ 1, 2 ]; -var d = [ +let d = [ 1, 2 ]; -var e = [ +let e = [ function foo() { dosomething(); } From c0879d8117394784e413c0b1178f28bb714550cf Mon Sep 17 00:00:00 2001 From: PoloSpark Date: Tue, 7 Jan 2025 10:37:05 -0700 Subject: [PATCH 3/9] docs: rewrite var using let and const --- docs/src/rules/accessor-pairs.md | 42 ++++++++++++++++---------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/docs/src/rules/accessor-pairs.md b/docs/src/rules/accessor-pairs.md index 4a8454b04a91..73a81719d1d3 100644 --- a/docs/src/rules/accessor-pairs.md +++ b/docs/src/rules/accessor-pairs.md @@ -25,7 +25,7 @@ let o = { // Good -let o = { +let p = { set a(value) { this.val = value; }, @@ -61,15 +61,15 @@ Examples of **incorrect** code for the default `{ "setWithoutGet": true }` optio ```js /*eslint accessor-pairs: "error"*/ -let o = { +let q = { set a(value) { this.val = value; } }; -let o = {d: 1}; -Object.defineProperty(o, 'c', { +let r = {d: 1}; +Object.defineProperty(r, 'c', { set: function(value) { this.val = value; } @@ -85,7 +85,7 @@ Examples of **correct** code for the default `{ "setWithoutGet": true }` option: ```js /*eslint accessor-pairs: "error"*/ -let o = { +let s = { set a(value) { this.val = value; }, @@ -94,8 +94,8 @@ let o = { } }; -let o = {d: 1}; -Object.defineProperty(o, 'c', { +let t = {d: 1}; +Object.defineProperty(t, 'c', { set: function(value) { this.val = value; }, @@ -117,27 +117,27 @@ Examples of **incorrect** code for the `{ "getWithoutSet": true }` option: ```js /*eslint accessor-pairs: ["error", { "getWithoutSet": true }]*/ -let o = { +let u = { set a(value) { this.val = value; } }; -let o = { +let v = { get a() { return this.val; } }; -let o = {d: 1}; -Object.defineProperty(o, 'c', { +let w = {d: 1}; +Object.defineProperty(w, 'c', { set: function(value) { this.val = value; } }); -let o = {d: 1}; -Object.defineProperty(o, 'c', { +let x = {d: 1}; +Object.defineProperty(x, 'c', { get: function() { return this.val; } @@ -152,7 +152,7 @@ Examples of **correct** code for the `{ "getWithoutSet": true }` option: ```js /*eslint accessor-pairs: ["error", { "getWithoutSet": true }]*/ -let o = { +let y = { set a(value) { this.val = value; }, @@ -161,8 +161,8 @@ let o = { } }; -let o = {d: 1}; -Object.defineProperty(o, 'c', { +let y = {d: 1}; +Object.defineProperty(y, 'c', { set: function(value) { this.val = value; }, @@ -281,14 +281,14 @@ might not report a missing pair for a getter/setter that has a computed key, lik ```js /*eslint accessor-pairs: "error"*/ -let a = 1; +let z = 1; // no warnings -let o = { - get [a++]() { +let a = { + get [z++]() { return this.val; }, - set [a++](value) { + set [z++](value) { this.val = value; } }; @@ -301,7 +301,7 @@ might not report a missing pair for a getter/setter, like in the following examp /*eslint accessor-pairs: "error"*/ // no warnings -let o = { +let b = { get a() { return this.val; }, From 74b5ac417a701709f67d1751ac88be04c96e76b4 Mon Sep 17 00:00:00 2001 From: PoloSpark Date: Tue, 7 Jan 2025 10:49:03 -0700 Subject: [PATCH 4/9] Update docs/src/rules/accessor-pairs.md Co-authored-by: Amaresh S M --- docs/src/rules/accessor-pairs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/rules/accessor-pairs.md b/docs/src/rules/accessor-pairs.md index 73a81719d1d3..a0fd07bea601 100644 --- a/docs/src/rules/accessor-pairs.md +++ b/docs/src/rules/accessor-pairs.md @@ -17,7 +17,7 @@ Here are some examples: ```js // Bad -let o = { +const o = { set a(value) { this.val = value; } From 8087bd2cf05be3958d824a9354d863e01b647925 Mon Sep 17 00:00:00 2001 From: PoloSpark Date: Tue, 7 Jan 2025 10:49:25 -0700 Subject: [PATCH 5/9] Update docs/src/rules/accessor-pairs.md Co-authored-by: Amaresh S M --- docs/src/rules/accessor-pairs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/rules/accessor-pairs.md b/docs/src/rules/accessor-pairs.md index a0fd07bea601..90765374c0d1 100644 --- a/docs/src/rules/accessor-pairs.md +++ b/docs/src/rules/accessor-pairs.md @@ -25,7 +25,7 @@ const o = { // Good -let p = { +const p = { set a(value) { this.val = value; }, From f393ab1e3a526268e94a5eb04729d32aade99533 Mon Sep 17 00:00:00 2001 From: PoloSpark Date: Tue, 7 Jan 2025 10:53:22 -0700 Subject: [PATCH 6/9] docs: rewrite using const --- docs/src/rules/accessor-pairs.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/src/rules/accessor-pairs.md b/docs/src/rules/accessor-pairs.md index 73a81719d1d3..96dd15035b00 100644 --- a/docs/src/rules/accessor-pairs.md +++ b/docs/src/rules/accessor-pairs.md @@ -68,7 +68,7 @@ let q = { }; -let r = {d: 1}; +const r = {d: 1}; Object.defineProperty(r, 'c', { set: function(value) { this.val = value; @@ -85,7 +85,7 @@ Examples of **correct** code for the default `{ "setWithoutGet": true }` option: ```js /*eslint accessor-pairs: "error"*/ -let s = { +const s = { set a(value) { this.val = value; }, @@ -94,7 +94,7 @@ let s = { } }; -let t = {d: 1}; +const t = {d: 1}; Object.defineProperty(t, 'c', { set: function(value) { this.val = value; @@ -161,7 +161,7 @@ let y = { } }; -let y = {d: 1}; +const z = {d: 1}; Object.defineProperty(y, 'c', { set: function(value) { this.val = value; @@ -284,7 +284,7 @@ might not report a missing pair for a getter/setter that has a computed key, lik let z = 1; // no warnings -let a = { +const a = { get [z++]() { return this.val; }, @@ -301,7 +301,7 @@ might not report a missing pair for a getter/setter, like in the following examp /*eslint accessor-pairs: "error"*/ // no warnings -let b = { +const b = { get a() { return this.val; }, From a1985d12510e41fba2b35a3575c6c4ee8b9d1b35 Mon Sep 17 00:00:00 2001 From: PoloSpark Date: Tue, 7 Jan 2025 12:14:44 -0700 Subject: [PATCH 7/9] Update accessor-pairs.md --- docs/src/rules/accessor-pairs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/rules/accessor-pairs.md b/docs/src/rules/accessor-pairs.md index a69dac9b5893..012b90712b8e 100644 --- a/docs/src/rules/accessor-pairs.md +++ b/docs/src/rules/accessor-pairs.md @@ -162,7 +162,7 @@ let y = { }; const z = {d: 1}; -Object.defineProperty(y, 'c', { +Object.defineProperty(z, 'c', { set: function(value) { this.val = value; }, From f2495f59426bb9c10113a6cca8d1efb9a823e59f Mon Sep 17 00:00:00 2001 From: PoloSpark Date: Wed, 8 Jan 2025 18:37:47 -0700 Subject: [PATCH 8/9] Update accessor-pairs.md --- docs/src/rules/accessor-pairs.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/src/rules/accessor-pairs.md b/docs/src/rules/accessor-pairs.md index 012b90712b8e..776b116e6d28 100644 --- a/docs/src/rules/accessor-pairs.md +++ b/docs/src/rules/accessor-pairs.md @@ -61,7 +61,7 @@ Examples of **incorrect** code for the default `{ "setWithoutGet": true }` optio ```js /*eslint accessor-pairs: "error"*/ -let q = { +const q = { set a(value) { this.val = value; } @@ -117,26 +117,26 @@ Examples of **incorrect** code for the `{ "getWithoutSet": true }` option: ```js /*eslint accessor-pairs: ["error", { "getWithoutSet": true }]*/ -let u = { +const u = { set a(value) { this.val = value; } }; -let v = { +const v = { get a() { return this.val; } }; -let w = {d: 1}; +const w = {d: 1}; Object.defineProperty(w, 'c', { set: function(value) { this.val = value; } }); -let x = {d: 1}; +const x = {d: 1}; Object.defineProperty(x, 'c', { get: function() { return this.val; @@ -152,7 +152,7 @@ Examples of **correct** code for the `{ "getWithoutSet": true }` option: ```js /*eslint accessor-pairs: ["error", { "getWithoutSet": true }]*/ -let y = { +const y = { set a(value) { this.val = value; }, @@ -281,7 +281,7 @@ might not report a missing pair for a getter/setter that has a computed key, lik ```js /*eslint accessor-pairs: "error"*/ -let z = 1; +const z = 1; // no warnings const a = { From 2f7af03d82105a1092a9434b1d60a4b399950b82 Mon Sep 17 00:00:00 2001 From: PoloSpark Date: Wed, 8 Jan 2025 19:19:07 -0700 Subject: [PATCH 9/9] Update let variables to const --- docs/src/rules/array-bracket-newline.md | 120 ++++++++++++------------ 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/docs/src/rules/array-bracket-newline.md b/docs/src/rules/array-bracket-newline.md index 88a68d5bc387..2c1c573c8014 100644 --- a/docs/src/rules/array-bracket-newline.md +++ b/docs/src/rules/array-bracket-newline.md @@ -35,12 +35,12 @@ Examples of **incorrect** code for this rule with the `"always"` option: ```js /*eslint array-bracket-newline: ["error", "always"]*/ -let a = []; -let b = [1]; -let c = [1, 2]; -let d = [1, +const a = []; +const b = [1]; +const c = [1, 2]; +const d = [1, 2]; -let e = [function foo() { +const e = [function foo() { dosomething(); }]; ``` @@ -54,19 +54,19 @@ Examples of **correct** code for this rule with the `"always"` option: ```js /*eslint array-bracket-newline: ["error", "always"]*/ -let a = [ +const a = [ ]; -let b = [ +const b = [ 1 ]; -let c = [ +const c = [ 1, 2 ]; -let d = [ +const d = [ 1, 2 ]; -let e = [ +const e = [ function foo() { dosomething(); } @@ -84,19 +84,19 @@ Examples of **incorrect** code for this rule with the `"never"` option: ```js /*eslint array-bracket-newline: ["error", "never"]*/ -let a = [ +const a = [ ]; -let b = [ +const b = [ 1 ]; -let c = [ +const c = [ 1, 2 ]; -let d = [ +const d = [ 1, 2 ]; -let e = [ +const e = [ function foo() { dosomething(); } @@ -112,12 +112,12 @@ Examples of **correct** code for this rule with the `"never"` option: ```js /*eslint array-bracket-newline: ["error", "never"]*/ -let a = []; -let b = [1]; -let c = [1, 2]; -let d = [1, +const a = []; +const b = [1]; +const c = [1, 2]; +const d = [1, 2]; -let e = [function foo() { +const e = [function foo() { dosomething(); }]; ``` @@ -133,15 +133,15 @@ Examples of **incorrect** code for this rule with the `"consistent"` option: ```js /*eslint array-bracket-newline: ["error", "consistent"]*/ -let a = [1 +const a = [1 ]; -let b = [ +const b = [ 1]; -let c = [function foo() { +const c = [function foo() { dosomething(); } ] -let d = [ +const d = [ function foo() { dosomething(); }] @@ -156,17 +156,17 @@ Examples of **correct** code for this rule with the `"consistent"` option: ```js /*eslint array-bracket-newline: ["error", "consistent"]*/ -let a = []; -let b = [ +const a = []; +const b = [ ]; -let c = [1]; -let d = [ +const c = [1]; +const d = [ 1 ]; -let e = [function foo() { +const e = [function foo() { dosomething(); }]; -let f = [ +const f = [ function foo() { dosomething(); } @@ -184,17 +184,17 @@ Examples of **incorrect** code for this rule with the default `{ "multiline": tr ```js /*eslint array-bracket-newline: ["error", { "multiline": true }]*/ -let a = [ +const a = [ ]; -let b = [ +const b = [ 1 ]; -let c = [ +const c = [ 1, 2 ]; -let d = [1, +const d = [1, 2]; -let e = [function foo() { +const e = [function foo() { dosomething(); }]; ``` @@ -208,14 +208,14 @@ Examples of **correct** code for this rule with the default `{ "multiline": true ```js /*eslint array-bracket-newline: ["error", { "multiline": true }]*/ -let a = []; -let b = [1]; -let c = [1, 2]; -let d = [ +const a = []; +const b = [1]; +const c = [1, 2]; +const d = [ 1, 2 ]; -let e = [ +const e = [ function foo() { dosomething(); } @@ -233,15 +233,15 @@ Examples of **incorrect** code for this rule with the `{ "minItems": 2 }` option ```js /*eslint array-bracket-newline: ["error", { "minItems": 2 }]*/ -let a = [ +const a = [ ]; -let b = [ +const b = [ 1 ]; -let c = [1, 2]; -let d = [1, +const c = [1, 2]; +const d = [1, 2]; -let e = [ +const e = [ function foo() { dosomething(); } @@ -257,16 +257,16 @@ Examples of **correct** code for this rule with the `{ "minItems": 2 }` option: ```js /*eslint array-bracket-newline: ["error", { "minItems": 2 }]*/ -let a = []; -let b = [1]; -let c = [ +const a = []; +const b = [1]; +const c = [ 1, 2 ]; -let d = [ +const d = [ 1, 2 ]; -let e = [function foo() { +const e = [function foo() { dosomething(); }]; ``` @@ -282,15 +282,15 @@ Examples of **incorrect** code for this rule with the `{ "multiline": true, "min ```js /*eslint array-bracket-newline: ["error", { "multiline": true, "minItems": 2 }]*/ -let a = [ +const a = [ ]; -let b = [ +const b = [ 1 ]; -let c = [1, 2]; -let d = [1, +const c = [1, 2]; +const d = [1, 2]; -let e = [function foo() { +const e = [function foo() { dosomething(); }]; ``` @@ -304,16 +304,16 @@ Examples of **correct** code for this rule with the `{ "multiline": true, "minIt ```js /*eslint array-bracket-newline: ["error", { "multiline": true, "minItems": 2 }]*/ -let a = []; -let b = [1]; -let c = [ +const a = []; +const b = [1]; +const c = [ 1, 2 ]; -let d = [ +const d = [ 1, 2 ]; -let e = [ +const e = [ function foo() { dosomething(); } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy