diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S108.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S108.html index 844691397d..d64cef4b5c 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S108.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S108.html @@ -2,9 +2,13 @@

Why is this an issue?

An empty code block is confusing. It will require some effort from maintainers to determine if it is intentional or indicates the implementation is incomplete.

-for (var i = 0; i < length; i++) {}  // Noncompliant: is the block empty on purpose, or is code missing?
+for (let i = 0; i < length; i++) {}  // Noncompliant: is the block empty on purpose, or is code missing?
 

Removing or filling the empty code blocks takes away ambiguity and generally results in a more straightforward and less surprising code.

Exceptions

-

The rule ignores: * code blocks that contain comments * catch blocks

+

The rule ignores:

+ diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S1128.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S1128.html index 165c456470..db273ec0b9 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S1128.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S1128.html @@ -19,8 +19,10 @@

Why is this an issue?

Resources

Documentation

+

Related rules

+ diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S1135.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S1135.html index fb14a2531b..603beb0815 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S1135.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S1135.html @@ -1,7 +1,20 @@

Why is this an issue?

-

TODO tags are commonly used to mark places where some more code is required, but which the developer wants to implement later.

-

Sometimes the developer will not have the time or will simply forget to get back to that tag.

-

This rule is meant to track those tags and to ensure that they do not go unnoticed.

+

Developers often use TOOO tags to mark areas in the code where additional work or improvements are needed but are not implemented +immediately. However, these TODO tags sometimes get overlooked or forgotten, leading to incomplete or unfinished code. This code smell +class aims to identify and address such unattended TODO tags to ensure a clean and maintainable codebase. This description will explore +why this is a problem and how it can be fixed to improve the overall code quality.

+

What is the potential impact?

+

Unattended TODO tags in code can have significant implications for the development process and the overall codebase.

+

Incomplete Functionality: When developers leave TODO tags without implementing the corresponding code, it results in incomplete +functionality within the software. This can lead to unexpected behavior or missing features, adversely affecting the end-user experience.

+

Missed Bug Fixes: If developers do not promptly address TODO tags, they might overlook critical bug fixes and security updates. +Delayed bug fixes can result in more severe issues and increase the effort required to resolve them later.

+

Impact on Collaboration: In team-based development environments, unattended TODO tags can hinder collaboration. Other team members +might not be aware of the intended changes, leading to conflicts or redundant efforts in the codebase.

+

Codebase Bloat: Accumulation of unattended TODO tags over time can clutter the codebase and make it difficult to distinguish between +work in progress and completed code. This bloat can make it challenging to maintain an organized and efficient codebase.

+

Addressing this code smell is essential to ensure a maintainable, readable, reliable codebase and promote effective collaboration among +developers.

Noncompliant code example

 function doSomething() {
diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S1481.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S1481.html
index ab998609ab..a4d8ca9b3c 100644
--- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S1481.html
+++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S1481.html
@@ -61,8 +61,8 @@ 

Resources

Documentation

Articles & blog posts

Identify and remove unreachable statements from your code.

-
+
 function func(a) {
   let i = 10;
   return i + a;
diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S2310.json b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S2310.json
index df06d1d691..4a60676352 100644
--- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S2310.json
+++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S2310.json
@@ -1,5 +1,5 @@
 {
-  "title": "Loop counters should not be assigned to from within the loop body",
+  "title": "Loop counters should not be assigned within the loop body",
   "type": "CODE_SMELL",
   "status": "ready",
   "remediation": {
diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S2692.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S2692.html
index d0f0b352f3..9ffd194661 100644
--- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S2692.html
+++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S2692.html
@@ -1,8 +1,8 @@
 

Why is this an issue?

Most checks against an indexOf value compare it with -1 because 0 is a valid index. Checking against > 0 ignores the first element, which is likely a bug.

-
-var arr = ["blue", "red"];
+
+let arr = ["blue", "red"];
 
 if (arr.indexOf("blue") > 0) { // Noncompliant
   // ...
@@ -10,8 +10,8 @@ 

Why is this an issue?

Moreover, if the intent is merely to check the presence of the element, and if your browser version supports it, consider using includes instead.

-
-var arr = ["blue", "red"];
+
+let arr = ["blue", "red"];
 
 if (arr.includes("blue")) {
   // ...
@@ -19,6 +19,7 @@ 

Why is this an issue?

This rule raises an issue when an indexOf value retrieved from an array is tested against > 0.

Resources

-

Array.prototype.includes() -documentation at MDN

+

Documentation

+

MDN - +Array.prototype.includes()

diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S2737.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S2737.html index fe44400947..7af8690d73 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S2737.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S2737.html @@ -21,4 +21,10 @@

Why is this an issue?

throw ex; }
+

Resources

+

Documentation

+ diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S2999.json b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S2999.json index 868423828b..b63c735028 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S2999.json +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S2999.json @@ -1,5 +1,5 @@ { - "title": "\"new\" operators should be used with functions", + "title": "\"new\" should only be used with functions and classes", "type": "BUG", "status": "ready", "remediation": { diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S3500.json b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S3500.json index fabfba641a..5a9c8d72d1 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S3500.json +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S3500.json @@ -1,5 +1,5 @@ { - "title": "Variables declared with \"const\" should not be reassigned", + "title": "\"const\" variables should not be reassigned", "type": "BUG", "status": "ready", "remediation": { diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S3799.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S3799.html index 5cec03abd2..f282168b31 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S3799.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S3799.html @@ -3,7 +3,7 @@

Why is this an issue?

concise and expressive by directly extracting values or properties needed from arrays or objects. However, it is possible to define an empty pattern that has no effect, where no variables are bound to the destructured values.

-var {a: {}} = myObj; // Noncompliant: this does not create any variable
+let {a: {}} = myObj; // Noncompliant: this does not create any variable
 function foo({p: []}) { // Noncompliant: this does not define any parameter
   // ...
 }
diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S3981.json b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S3981.json
index 28d2a147f8..7874ff9326 100644
--- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S3981.json
+++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S3981.json
@@ -1,5 +1,5 @@
 {
-  "title": "Collection sizes and array length comparisons should make sense",
+  "title": "Collection size and array length comparisons should make sense",
   "type": "BUG",
   "status": "ready",
   "remediation": {
diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S4030.json b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S4030.json
index e49a487541..11e7cb3781 100644
--- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S4030.json
+++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S4030.json
@@ -1,5 +1,5 @@
 {
-  "title": "Collection and array contents should be used",
+  "title": "Collection contents should be used",
   "type": "CODE_SMELL",
   "status": "ready",
   "remediation": {
diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S4043.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S4043.html
index 931c88f324..25fce65d98 100644
--- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S4043.html
+++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S4043.html
@@ -17,12 +17,12 @@ 

Why is this an issue?

const reversed = a.toReversed(); const sorted = b.toSorted();
-

Alternatively, change a mutating method into a non-mutating alternative using the spread syntax (…​) or slice() to create -a copy first.

+

Alternatively, change a mutating method into a non-mutating alternative using the spread syntax (…​).

 const reversed = [...a].reverse();
 const sorted = [...b].sort();
 
+

Or slice() to create a copy first.

 const reversed = a.slice().reverse();
 const sorted = b.slice().sort();
diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S4143.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S4143.html
index f56499df94..272cef17e7 100644
--- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S4143.html
+++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S4143.html
@@ -3,14 +3,14 @@ 

Why is this an issue?

a "dead store".

This rule detects repeatedly adding an element at the same index or key in a collection or adding identical elements to a set.

- fruits[1] = "banana";
- fruits[1] = "apple";  // Noncompliant
+fruits[1] = "banana";
+fruits[1] = "apple";  // Noncompliant
 
- myMap.set("key", 1);
- myMap.set("key", 2); // Noncompliant
+myMap.set("key", 1);
+myMap.set("key", 2); // Noncompliant
 
- mySet.add(1);
- mySet.add(1); // Noncompliant
+mySet.add(1);
+mySet.add(1); // Noncompliant
 

This practice is redundant and will cause confusion for the reader. More importantly, it is often an error and not what the developer intended to do.

diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S4524.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S4524.html index 0380b7a725..9bc56850c0 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S4524.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S4524.html @@ -17,4 +17,9 @@

Why is this an issue?

break; }
+

Resources

+

Documentation

+ diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S4619.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S4619.html index 5f0e27b346..a630cdbee3 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S4619.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S4619.html @@ -3,7 +3,7 @@

Why is this an issue?

href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain">prototype chain.

When used on an array, it will compare against the indexes of the array, not the values. This is likely not to be the expected behavior.

-function func1() {
+function func() {
     const arr = ["a", "b", "c"];
 
     const expectedValue = "b";
@@ -22,7 +22,7 @@ 

Why is this an issue?

const expectedValue = "b"; if (arr.includes(expectedValue)) { - return expectedValue + " was found in the array"; + return expectedValue + " found in the array"; } else { return expectedValue + " not found"; } diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S4822.json b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S4822.json index 6626a5c1de..7d8e5db34c 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S4822.json +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S4822.json @@ -1,5 +1,5 @@ { - "title": "Promise rejections should not be caught by \u0027try\u0027 block", + "title": "Promise rejections should not be caught by \u0027try\u0027 blocks", "type": "BUG", "status": "ready", "remediation": { diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6092.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6092.html index 630edb7d14..aacfaf02f9 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6092.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6092.html @@ -112,13 +112,16 @@

Why is this an issue?

easier to do so when the test is focused on a single behavior or functionality.

Resources

Documentation

-

Chai.js - .by Chai.js -- .change Chai.js - .decrease Chai.js - .finite Chai.js - .include Chai.js - .increase Chai.js - .members Chai.js - .ownPropertyDescriptor Chai.js - .property Chai.js - .throw

+ diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6509.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6509.html index 6525e4601f..7b09a89db1 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6509.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6509.html @@ -15,8 +15,7 @@

Why is this an issue?

}

A redundant boolean cast affects code readability. Not only the condition becomes more verbose but it also misleads the reader who might question -the intent behind the extra cast.

-

The condition can be written without the Boolean cast.

+the intent behind the extra cast. The condition can be written without the Boolean cast.

 if (foo) {
     // ...
@@ -25,11 +24,11 @@ 

Why is this an issue?

Resources

Documentation

Articles & blog posts

    diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6535.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6535.html index adfe33108e..5f025e5706 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6535.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6535.html @@ -22,7 +22,7 @@

    Why is this an issue?

    Resources

    Documentation

    diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6544.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6544.html index b1cc9e1175..d1e9884bcc 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6544.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6544.html @@ -109,9 +109,9 @@

    How does this work?

    Resources

    Documentation

    diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6551.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6551.html index aeedebd9d9..e67f95c9f0 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6551.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6551.html @@ -47,7 +47,9 @@

    Compliant solution

    foo.toString();

Resources

+

Documentation

diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6565.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6565.html index d2a77b6eae..ae9763c3ab 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6565.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6565.html @@ -101,7 +101,7 @@

Compliant solution

Resources

Documentation

diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6568.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6568.html index d3762dadfc..a4c2da3b82 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6568.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6568.html @@ -32,8 +32,9 @@

Compliant solution

}

Resources

+

Documentation

diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6569.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6569.html index 7da1d08776..dc1e2c4e2b 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6569.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6569.html @@ -23,7 +23,7 @@

Compliant solution

Resources

Documentation

diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6571.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6571.html index 5b3d3822ff..0de9224829 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6571.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6571.html @@ -38,7 +38,7 @@

Compliant solution

Resources

Documentation

diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6572.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6572.html index d9edbd342a..db361841ab 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6572.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6572.html @@ -52,6 +52,6 @@

Compliant solution

Resources

Documentation

diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6578.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6578.html index baa2d516db..ab0b85c87b 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6578.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6578.html @@ -22,6 +22,6 @@

Compliant solution

Resources

Documentation

diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6582.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6582.html index 5e64435fd3..9af7e3b1e9 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6582.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6582.html @@ -26,6 +26,6 @@

Compliant solution

Resources

Documentation

diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6583.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6583.html index 0525589efb..b2f1b6390a 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6583.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6583.html @@ -40,6 +40,6 @@

Compliant solution

Resources

Documentation

diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6594.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6594.html index c7b73d9c9f..d9ea47deb3 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6594.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6594.html @@ -4,21 +4,19 @@

Why is this an issue?

preferred for better performance.

The rule reports an issue on a call to String.match() whenever it can be replaced with semantically equivalent RegExp.exec().

-

How to fix it

-

Rewrite the pattern matching from string.match(regex) to regex.exec(string).

-

Code examples

-

Noncompliant code example

 'foo'.match(/bar/);
 
-

Compliant solution

+

Rewrite the pattern matching from string.match(regex) to regex.exec(string).

 /bar/.exec('foo');
 

Resources

Documentation

diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6598.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6598.html index 073583557c..32b96feb90 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6598.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6598.html @@ -33,7 +33,7 @@

Compliant solution

Resources

Documentation

diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6606.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6606.html index cce06a2595..e5dc45e896 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6606.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6606.html @@ -34,6 +34,6 @@

Compliant solution

Resources

diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6635.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6635.html index 277b73a5de..06fc2d758e 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6635.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6635.html @@ -35,6 +35,6 @@

Compliant solution

Resources

Documentation

diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6637.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6637.html index fa5537bab4..647c88e9f0 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6637.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6637.html @@ -30,6 +30,7 @@

Compliant solution

Resources

Documentation

diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6637.json b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6637.json index 61881b47a1..7552e863e5 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6637.json +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6637.json @@ -1,5 +1,5 @@ { - "title": "Unnecessary calls to .bind() should not be used", + "title": "Unnecessary calls to \".bind()\" should not be used", "type": "CODE_SMELL", "status": "ready", "remediation": { diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6643.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6643.html index 2a9fbda4df..dd93d44f42 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6643.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6643.html @@ -15,8 +15,8 @@

Noncompliant code example

Resources

Documentation

diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6645.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6645.html index 76aad3d7fa..c9b433fd52 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6645.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6645.html @@ -2,15 +2,15 @@

Why is this an issue?

Initializing a variable to undefined is unnecessary and should be avoided. A variable will automatically be set to undefined if you declare it without initialization, so the initialization code is redundant in this case.

-var foo = undefined; // Non-compliant, replace with var foo;
-let bar = undefined; // Non-compliant, replace with let foo;
+var foo = undefined; // Noncompliant: replace with var foo;
+let bar = undefined; // Noncompliant: replace with let foo;
 

Resources

Documentation

diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6647.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6647.html index e9fd53cb4a..14b751a09b 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6647.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6647.html @@ -1,19 +1,19 @@

Why is this an issue?

If the class declaration does not include a constructor, one is automatically created, so there is no need to provide an empty constructor, or one that just delegates to the parent class.

-
+
 class Foo {
     constructor() {}  // Noncompliant, empty
 }
 
 class Bar extends Foo {
-    constructor(params) { // Noncompliant, just delegates to the parent
+    constructor(params) { // Noncompliant: just delegates to the parent
         super(params);
     }
 }
 

Instead, you can safely remove the empty constructor without affecting the functionality.

-
+
 class Foo {}
 
 class Bar extends Foo {}
diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6650.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6650.html
index 85f2c11c76..4d19042518 100644
--- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6650.html
+++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6650.html
@@ -1,13 +1,13 @@
 

Why is this an issue?

Renaming imports, exports, or destructuring assignments to the same name is redundant and can be safely removed. You may accidentally end up with such code if you do a refactoring and change the local name in several places.

-
+
 import { foo as foo } from "bar";
 export { foo as foo };
 let { foo: foo } = bar;
 

Fix your code to remove the unnecessary renaming.

-
+
 import { foo } from "bar";
 export { foo };
 let { foo } = bar;
diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6654.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6654.html
index 21cd68230b..8767a69521 100644
--- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6654.html
+++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6654.html
@@ -1,5 +1,5 @@
 

Why is this an issue?

-

Javascript has a prototypical inheritance model. Each object has an internal property that points to another object, called a +

JavaScript has a prototypical inheritance model. Each object has an internal property that points to another object, called a prototype. That prototype object has a prototype of its own, and the whole sequence is called a prototype chain. When accessing a property or a method of an object, if it is not found at the top level, the search continues through the object’s prototype and then further down the prototype chain. This feature allows for very powerful dynamic inheritance patterns but can also lead to confusion when compared to @@ -7,13 +7,13 @@

Why is this an issue?

To simplify the access to the prototype of an object some browsers introduced the __proto__ property, which was later deprecated and removed from the language. The current ECMAScript standard includes Object.getPrototype and Object.setPrototype static methods that should be used instead of the __proto__ property.

-
-let prototype = foo.__proto__;  // Noncompliant, use Object.getPrototype
-foo.__proto__ = bar; // Noncompliant, use Object.setPrototype
+
+let prototype = foo.__proto__;  // Noncompliant: use Object.getPrototype
+foo.__proto__ = bar; // Noncompliant: use Object.setPrototype
 

To fix your code replace __proto__ with calls to Object.getPrototype and Object.setPrototype static methods.

-
+
 let prototype = Object.getPrototype(foo);
 Object.setPrototype(foo, bar);
 
diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6657.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6657.html index 338b436fe0..701c17380d 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6657.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6657.html @@ -2,17 +2,17 @@

Why is this an issue?

Octal escape sequences in string literals have been deprecated since ECMAScript 5 and should not be used in modern JavaScript code.

Many developers may not have experience with this format and may confuse it with the decimal notation.

-var message = "Copyright \251"; // Noncompliant
+let message = "Copyright \251"; // Noncompliant
 

The better way to insert special characters is to use Unicode or hexadecimal escape sequences.

-var message1 = "Copyright \u00A9";  // unicode
-var message2 = "Copyright \xA9";    // hexadecimal
+let message1 = "Copyright \u00A9";  // unicode
+let message2 = "Copyright \xA9";    // hexadecimal
 

Resources

Documentation

diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6661.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6661.html index 35026ab7b1..fc9f72292a 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6661.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6661.html @@ -19,7 +19,7 @@

Why is this an issue?

Resources

Documentation

    -
  • MDN - spread in +
  • MDN - Spread in object literals
  • MDN - Object.assign()
  • diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6666.json b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6666.json index 4587a6e971..c42981ea5a 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6666.json +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6666.json @@ -1,5 +1,5 @@ { - "title": "Spread syntax should be used instead of apply()", + "title": "Spread syntax should be used instead of \"apply()\"", "type": "CODE_SMELL", "status": "ready", "remediation": { diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6671.html b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6671.html index 5f82cf8ae2..467f944926 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6671.html +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6671.html @@ -28,7 +28,10 @@

    Resources

    Documentation

    +

    Related rules

    +
      +
    • {rule:javascript:S3696} - Literals should not be thrown
    diff --git a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6676.json b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6676.json index bbe54cfb34..3ba7ef790d 100644 --- a/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6676.json +++ b/sonar-plugin/javascript-checks/src/main/resources/org/sonar/l10n/javascript/rules/javascript/S6676.json @@ -1,5 +1,5 @@ { - "title": "Calls to .call() and .apply() methods should not be redundant", + "title": "Calls to \".call()\" and \".apply()\" methods should not be redundant", "type": "CODE_SMELL", "status": "ready", "remediation": { diff --git a/sonarpedia.json b/sonarpedia.json index fd9ba45be5..d5f5b46e42 100644 --- a/sonarpedia.json +++ b/sonarpedia.json @@ -3,7 +3,7 @@ "languages": [ "JS" ], - "latest-update": "2023-07-28T11:18:38.814591400Z", + "latest-update": "2023-08-04T06:51:59.850090Z", "options": { "no-language-in-filenames": true, "preserve-filenames": true