Skip to content

Commit 45bf071

Browse files
committed
Enable strict mode.
1 parent 15043ef commit 45bf071

File tree

100 files changed

+134
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+134
-5
lines changed

.jshintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
"noempty": true,
1212
"nonbsp": true,
1313
"quotmark": "double",
14-
"unused": true,
14+
"strict": true,
1515
"undef": true,
16+
"unused": true,
1617
"globals": {
1718
"CSSLint": true,
1819
"YUITest": true

Gruntfile.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/* jshint camelcase:false, evil:true, node:true */
22

3+
"use strict";
4+
35
module.exports = function(grunt) {
46

57
// Project configuration.

demos/CSSLintDemo.htm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ <h1>CSSLint Demo</h1>
7878
<div id="output"></div>
7979
<script>
8080
(function() {
81+
"use strict";
8182

8283
document.body.onclick = function(event) {
8384
event = event || window.event;

src/cli/common.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
/* exported cli */
77

88
function cli(api){
9+
"use strict";
910

1011
var globalOptions = {
1112
"help" : { "format" : "", "description" : "Displays this information."},

src/cli/node.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,17 @@ cli({
1414
args: process.argv.slice(2),
1515

1616
print: function(message){
17+
"use strict";
1718
fs.writeSync(1, message + "\n");
1819
},
1920

2021
quit: function(code){
22+
"use strict";
2123
process.exit(code || 0);
2224
},
2325

2426
isDirectory: function(name){
27+
"use strict";
2528
try {
2629
return fs.statSync(name).isDirectory();
2730
} catch (ex) {
@@ -30,6 +33,7 @@ cli({
3033
},
3134

3235
getFiles: function(dir){
36+
"use strict";
3337
var files = [];
3438

3539
try {
@@ -61,14 +65,17 @@ cli({
6165
},
6266

6367
getWorkingDirectory: function() {
68+
"use strict";
6469
return process.cwd();
6570
},
6671

6772
getFullPath: function(filename){
73+
"use strict";
6874
return path.resolve(process.cwd(), filename);
6975
},
7076

7177
readFile: function(filename){
78+
"use strict";
7279
try {
7380
return fs.readFileSync(filename, "utf-8");
7481
} catch (ex) {

src/cli/rhino.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,19 @@
88
importPackage(java.io);
99

1010
cli({
11+
1112
args: Array.prototype.concat.call(arguments),
1213
print: print,
1314
quit: quit,
1415

1516
isDirectory: function(name){
17+
"use strict";
1618
var dir = new File(name);
1719
return dir.isDirectory();
1820
},
1921

2022
getFiles: function(dir){
23+
"use strict";
2124
var files = [];
2225

2326
function traverse(dir) {
@@ -37,14 +40,17 @@ cli({
3740
},
3841

3942
getWorkingDirectory: function() {
43+
"use strict";
4044
return (new File(".")).getCanonicalPath();
4145
},
4246

4347
getFullPath: function(filename){
48+
"use strict";
4449
return (new File(filename)).getCanonicalPath();
4550
},
4651

4752
readFile: function(filename) {
53+
"use strict";
4854
try {
4955
return readFile(filename);
5056
} catch (ex) {

src/cli/wsh.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
/* global cli */
99

1010
var wshapi = (function(){
11+
"use strict";
12+
1113
var fso = new ActiveXObject("Scripting.FileSystemObject");
1214
var shell = WScript.CreateObject("WScript.Shell");
1315
var finalArgs = [], i, args = WScript.Arguments;
@@ -41,7 +43,6 @@ var wshapi = (function(){
4143

4244
if (!Array.prototype.indexOf) {
4345
Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
44-
"use strict";
4546
if (this === void 0 || this === null) {
4647
throw new Error("unknown instance");
4748
}

src/core/CSSLint.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
/* exported CSSLint */
1010

1111
var CSSLint = (function(){
12+
"use strict";
1213

1314
var rules = [],
1415
formatters = [],

src/core/Reporter.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* they are errors or warnings.
99
*/
1010
function Reporter(lines, ruleset){
11+
"use strict";
1112

1213
/**
1314
* List of messages being reported.
@@ -54,6 +55,7 @@ Reporter.prototype = {
5455
* @method error
5556
*/
5657
error: function(message, line, col, rule){
58+
"use strict";
5759
this.messages.push({
5860
type : "error",
5961
line : line,
@@ -74,6 +76,7 @@ Reporter.prototype = {
7476
* @deprecated Use report instead.
7577
*/
7678
warn: function(message, line, col, rule){
79+
"use strict";
7780
this.report(message, line, col, rule);
7881
},
7982

@@ -86,6 +89,7 @@ Reporter.prototype = {
8689
* @method report
8790
*/
8891
report: function(message, line, col, rule){
92+
"use strict";
8993
this.messages.push({
9094
type : this.ruleset[rule.id] === 2 ? "error" : "warning",
9195
line : line,
@@ -105,6 +109,7 @@ Reporter.prototype = {
105109
* @method info
106110
*/
107111
info: function(message, line, col, rule){
112+
"use strict";
108113
this.messages.push({
109114
type : "info",
110115
line : line,
@@ -122,6 +127,7 @@ Reporter.prototype = {
122127
* @method rollupError
123128
*/
124129
rollupError: function(message, rule){
130+
"use strict";
125131
this.messages.push({
126132
type : "error",
127133
rollup : true,
@@ -137,6 +143,7 @@ Reporter.prototype = {
137143
* @method rollupWarn
138144
*/
139145
rollupWarn: function(message, rule){
146+
"use strict";
140147
this.messages.push({
141148
type : "warning",
142149
rollup : true,
@@ -152,6 +159,7 @@ Reporter.prototype = {
152159
* @method stat
153160
*/
154161
stat: function(name, value){
162+
"use strict";
155163
this.stats[name] = value;
156164
}
157165
};

src/core/Util.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ CSSLint.Util = {
1111
* @return {Object} The receiver
1212
*/
1313
mix: function(receiver, supplier){
14+
"use strict";
1415
var prop;
1516

1617
for (prop in supplier){
@@ -29,6 +30,7 @@ CSSLint.Util = {
2930
* @return {int} The index of the value if found, -1 if not.
3031
*/
3132
indexOf: function(values, value){
33+
"use strict";
3234
if (values.indexOf){
3335
return values.indexOf(value);
3436
} else {
@@ -48,6 +50,7 @@ CSSLint.Util = {
4850
* @return {void}
4951
*/
5052
forEach: function(values, func) {
53+
"use strict";
5154
if (values.forEach){
5255
return values.forEach(func);
5356
} else {

0 commit comments

Comments
 (0)