mirror of
https://github.com/github/codeql.git
synced 2026-05-04 05:05:12 +02:00
JS: Update OK-style comments to $-style
This commit is contained in:
@@ -12,10 +12,10 @@ class SingletonTreeModel implements ITreeModel {
|
||||
isLeafNode(node: Node): node is LeafNode {
|
||||
return node instanceof LeafNode;
|
||||
}
|
||||
isBranchNode(node: Node): node is BranchNode { // OK
|
||||
isBranchNode(node: Node): node is BranchNode {
|
||||
return false; // This model has no branches.
|
||||
}
|
||||
isValidNode(node: Node): boolean { // NOT OK
|
||||
isValidNode(node: Node): boolean { // $ Alert
|
||||
return Node != null; // woops
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class C {
|
||||
constructor(public x: number) {} // OK
|
||||
constructor(public x: number) {}
|
||||
}
|
||||
|
||||
class D {
|
||||
constructor(x: number) {} // NOT OK
|
||||
constructor(x: number) {} // $ Alert
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
function foo(this: void, x: number) { // OK: 'this' is not an ordinary parameter
|
||||
function foo(this: void, x: number) { // OK - 'this' is not an ordinary parameter
|
||||
return x;
|
||||
}
|
||||
|
||||
@@ -1,28 +1,26 @@
|
||||
// OK
|
||||
|
||||
[1, , 3].forEach(function(elt, idx) {
|
||||
console.log(idx + " is not omitted.");
|
||||
});
|
||||
|
||||
// NOT OK
|
||||
[1, , 3].forEach(function(elt, idx) {
|
||||
[1, , 3].forEach(function(elt, idx) { // $ Alert
|
||||
sum += elt;
|
||||
});
|
||||
|
||||
// NOT OK
|
||||
function f1(x, y) {
|
||||
function f1(x, y) { // $ Alert
|
||||
return y;
|
||||
}
|
||||
|
||||
f1(23, 42);
|
||||
|
||||
// OK
|
||||
|
||||
function f2(x, y) {
|
||||
return y;
|
||||
}
|
||||
|
||||
[].map(f2);
|
||||
|
||||
// OK
|
||||
|
||||
function f3(x, y) {
|
||||
return y;
|
||||
}
|
||||
@@ -30,11 +28,11 @@ function f3(x, y) {
|
||||
var g = f3;
|
||||
[].map(g);
|
||||
|
||||
// OK
|
||||
|
||||
define(function (require, exports, module) {
|
||||
module.x = 23;
|
||||
});
|
||||
|
||||
// OK: starts with underscore
|
||||
// OK - starts with underscore
|
||||
function f(_p) {
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
function f(x, y) { // NOT OK
|
||||
function f(x, y) { // $ Alert
|
||||
return y;
|
||||
}
|
||||
|
||||
function g(x, y) { // OK
|
||||
function g(x, y) {
|
||||
return y + arguments[0];
|
||||
}
|
||||
|
||||
function h(x) { // OK
|
||||
function h(x) {
|
||||
function inner() {
|
||||
x = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
/**
|
||||
* @param {*} x the first argument, deliberately unused
|
||||
* @param {*} y the second argument
|
||||
@@ -21,8 +21,7 @@ function K(x, y) {
|
||||
return y;
|
||||
}
|
||||
|
||||
// NOT OK
|
||||
/**
|
||||
/** // $ Alert
|
||||
* @param {*} x the first argument
|
||||
* @param {*} y the second argument
|
||||
*/
|
||||
@@ -30,7 +29,7 @@ function K(x, y) {
|
||||
return y;
|
||||
}
|
||||
|
||||
// OK
|
||||
|
||||
/**
|
||||
* @abstract
|
||||
* @param {*} x the first argument
|
||||
|
||||
Reference in New Issue
Block a user