-
Notifications
You must be signed in to change notification settings - Fork 1.8k
JS: Remove two invalid QHelp links #20687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
QHelp previews: javascript/ql/src/Expressions/ExprHasNoEffect.qhelpExpression has no effectAn expression that has no effects (such as changing variable values or producing output) and occurs in a context where its value is ignored possibly indicates missing code or a latent bug. RecommendationCarefully inspect the expression to ensure it is not a symptom of a bug. To document that the value of an expression is deliberately ignored, wrap it into a ExampleThe following code snippet accesses the elem.parentNode.selectedIndex;To document the fact that the property read has a hidden side effect and its value is deliberately ignored, it should be wrapped into a void(elem.parentNode.selectedIndex);A common source of warnings are constructor functions that "declare" a property of the newly constructed object without initializing it, by simply referring to it in an expression statement like this: function Graph(nodes, edges) {
this.nodes = nodes;
this.edges = edges;
// cache minimum distance between pairs of nodes
this.distance;
}Semantically, this is unnecessary, since the property will be created upon first assignment. If the aim is to document the existence of the property, it would be better to explicitly assign it an initial value, which also serves to document its expected type: function Graph(nodes, edges) {
this.nodes = nodes;
this.edges = edges;
// cache minimum distance between pairs of nodes
this.distance = {};
}javascript/ql/src/LanguageFeatures/DeleteVar.qhelpDeleting non-propertyThe RecommendationIf the variable you are deleting is a global variable, this is a sign that your code relies too much on global state. Try encapsulating this global state by means of one of the module patterns introduced in JavaScript: The Good Parts. ExampleIn the following code snippet, var cache;
function init() {
cache = {};
}
function done() {
delete cache;
}
function get(k) {
k = '$' + k;
if (!cache.hasOwnProperty(k))
cache[k] = compute(k);
return cache[k];
}
function compute(k) {
// compute value for k
// ...
}It would be clearer to wrap the whole module into a closure like this (which also avoids exposing function (function(global) {
var cache;
global.init = function init() {
cache = {};
};
global.done = function done() {
};
global.get = function get(k) {
k = '$' + k;
if (!cache.hasOwnProperty(k))
cache[k] = compute(k);
return cache[k];
}
function compute(k) {
// compute value for k
// ...
}
}(this)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR removes two invalid external reference links from QHelp documentation files that were pointing to the now-defunct jslinterrors.com website.
- Removed broken JSLint Error Explanations references from two QHelp files
- Cleaned up empty reference sections that only contained the invalid links
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| javascript/ql/src/LanguageFeatures/DeleteVar.qhelp | Removed broken jslinterrors.com reference link and empty references section |
| javascript/ql/src/Expressions/ExprHasNoEffect.qhelp | Removed broken jslinterrors.com reference link and empty references section |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Napalys
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Thanks to @mysteq for pointing out here.