Skip to content

Commit 15043ef

Browse files
committed
Enable JSHint's eqeqeq rule and remove eqnull.
1 parent 635c915 commit 15043ef

30 files changed

+48
-48
lines changed

.jshintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"camelcase": true,
33
"curly": true,
4-
"eqnull": true,
4+
"eqeqeq": true,
55
"forin": true,
66
"immed": true,
77
"indent": 4,

demos/CSSLintDemo.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ <h1>CSSLint Demo</h1>
8585
results, messages, i, len;
8686

8787

88-
if (target.id == "lint-btn") {
88+
if (target.id === "lint-btn") {
8989
document.getElementById("output").innerHTML = "";
9090
results = CSSLint.verify(document.getElementById("input").value);
9191
messages = results.messages;

src/cli/node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ cli({
4444
var path = stack.concat([file]).join("/"),
4545
stat = fs.statSync(path);
4646

47-
if (file[0] == ".") {
47+
if (file[0] === ".") {
4848
return;
4949
} else if (stat.isFile() && /\.css$/.test(file)){
5050
files.push(path);

src/cli/wsh.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var wshapi = (function(){
2222

2323
if (typeof Array.prototype.filter !== "function") {
2424
Array.prototype.filter = function(fn /*, thisp*/) {
25-
if (typeof fn != "function") {
25+
if (typeof fn !== "function") {
2626
throw new Error("not a function");
2727
}
2828
var res = [], val, thisp = finalArgs[1];

src/core/Reporter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Reporter.prototype = {
8787
*/
8888
report: function(message, line, col, rule){
8989
this.messages.push({
90-
type : this.ruleset[rule.id] == 2 ? "error" : "warning",
90+
type : this.ruleset[rule.id] === 2 ? "error" : "warning",
9191
line : line,
9292
col : col,
9393
message : message,

src/formatters/text.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ CSSLint.addFormatter({
3636
}
3737

3838
output = "\n\ncsslint: There ";
39-
if (messages.length == 1) {
39+
if (messages.length === 1) {
4040
output += "is 1 problem";
4141
} else {
4242
output += "are " + messages.length + " problems";

src/rules/adjoining-classes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ CSSLint.addRule({
2525
selector = selectors[i];
2626
for (j=0; j < selector.parts.length; j++){
2727
part = selector.parts[j];
28-
if (part.type == parser.SELECTOR_PART_TYPE){
28+
if (part.type === parser.SELECTOR_PART_TYPE){
2929
classCount = 0;
3030
for (k=0; k < part.modifiers.length; k++){
3131
modifier = part.modifiers[k];
32-
if (modifier.type == "class"){
32+
if (modifier.type === "class"){
3333
classCount++;
3434
}
3535
if (classCount > 1){

src/rules/box-model.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ CSSLint.addRule({
4545
if (heightProperties.hasOwnProperty(prop) && properties[prop]){
4646
value = properties[prop].value;
4747
//special case for padding
48-
if (!(prop == "padding" && value.parts.length === 2 && value.parts[0].value === 0)){
48+
if (!(prop === "padding" && value.parts.length === 2 && value.parts[0].value === 0)){
4949
reporter.report("Using height with " + prop + " can sometimes make elements larger than you expect.", properties[prop].line, properties[prop].col, rule);
5050
}
5151
}
@@ -57,7 +57,7 @@ CSSLint.addRule({
5757
if (widthProperties.hasOwnProperty(prop) && properties[prop]){
5858
value = properties[prop].value;
5959

60-
if (!(prop == "padding" && value.parts.length === 2 && value.parts[1].value === 0)){
60+
if (!(prop === "padding" && value.parts.length === 2 && value.parts[1].value === 0)){
6161
reporter.report("Using width with " + prop + " can sometimes make elements larger than you expect.", properties[prop].line, properties[prop].col, rule);
6262
}
6363
}
@@ -76,13 +76,13 @@ CSSLint.addRule({
7676
var name = event.property.text.toLowerCase();
7777

7878
if (heightProperties[name] || widthProperties[name]){
79-
if (!/^0\S*$/.test(event.value) && !(name == "border" && event.value == "none")){
79+
if (!/^0\S*$/.test(event.value) && !(name === "border" && event.value === "none")){
8080
properties[name] = { line: event.property.line, col: event.property.col, value: event.value };
8181
}
8282
} else {
8383
if (/^(width|height)/i.test(name) && /^(length|percentage)/.test(event.value.parts[0].type)){
8484
properties[name] = 1;
85-
} else if (name == "box-sizing") {
85+
} else if (name === "box-sizing") {
8686
boxSizing = true;
8787
}
8888
}

src/rules/box-sizing.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ CSSLint.addRule({
1818
parser.addListener("property", function(event){
1919
var name = event.property.text.toLowerCase();
2020

21-
if (name == "box-sizing"){
21+
if (name === "box-sizing"){
2222
reporter.report("The box-sizing property isn't supported in IE6 and IE7.", event.line, event.col, rule);
2323
}
2424
});

src/rules/compatible-vendor-prefixes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ CSSLint.addRule({
116116
if (CSSLint.Util.indexOf(applyTo, name.text) > -1) {
117117

118118
// e.g., -moz-transform is okay to be alone in @-moz-keyframes
119-
if (!inKeyFrame || typeof inKeyFrame != "string" ||
119+
if (!inKeyFrame || typeof inKeyFrame !== "string" ||
120120
name.text.indexOf("-" + inKeyFrame + "-") !== 0) {
121121
properties.push(name);
122122
}
@@ -173,7 +173,7 @@ CSSLint.addRule({
173173
for (i = 0, len = full.length; i < len; i++) {
174174
item = full[i];
175175
if (CSSLint.Util.indexOf(actual, item) === -1) {
176-
propertiesSpecified = (actual.length === 1) ? actual[0] : (actual.length == 2) ? actual.join(" and ") : actual.join(", ");
176+
propertiesSpecified = (actual.length === 1) ? actual[0] : (actual.length === 2) ? actual.join(" and ") : actual.join(", ");
177177
reporter.report("The property " + item + " is compatible with " + propertiesSpecified + " and should be included as well.", value.actualNodes[0].line, value.actualNodes[0].col, rule);
178178
}
179179
}

0 commit comments

Comments
 (0)