Skip to content

Commit 8877fa7

Browse files
committed
Fix lint error, update lint ignores.
1 parent e73017c commit 8877fa7

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

.jscsrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"test/**",
1717
"node_modules",
1818
"coverage",
19-
"doc"
19+
"doc",
20+
"async-validate.js"
2021
]
2122
}

.jshintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules
22
test
33
coverage
44
doc
5+
async-validate.js

plugin/util/type.js

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ module.exports = function() {
1616
this.messages.types.instance,
1717
this.field, Type.name || 'function (anonymous)');
1818
}
19-
// null type
2019
}else if(id === 'null') {
2120
invalid = this.value !== null;
22-
// regexp as RegExp or valid string expression
2321
}else if(id === 'regexp') {
2422
if(!(this.value instanceof RegExp)) {
2523
try {
@@ -28,28 +26,19 @@ module.exports = function() {
2826
invalid = true;
2927
}
3028
}
31-
// string type
3229
}else if(id === 'string') {
3330
invalid = typeof this.value !== 'string' && this.validates();
34-
// object type
3531
}else if(id === 'object') {
3632
invalid = (typeof(this.value) !== 'object'
3733
|| Array.isArray(this.value));
38-
// array type
3934
}else if(id === 'array') {
4035
invalid = !Array.isArray(this.value);
41-
// float type
4236
}else if(id === 'float') {
4337
invalid = typeof(this.value) !== 'number'
4438
|| Number(this.value) === parseInt(this.value);
45-
// integer type
4639
}else if(id === 'integer') {
4740
invalid = typeof(this.value) !== 'number'
4841
|| Number(this.value) !== parseInt(this.value);
49-
// TODO: rename method -> function so that it can share the
50-
// TODO: conditional below
51-
}else if(id === 'method') {
52-
invalid = typeof(this.value) !== 'function';
5342
// straight typeof test
5443
}else{
5544
invalid = typeof(this.value) !== id;
@@ -69,7 +58,7 @@ module.exports = function() {
6958
* @param cb Callback function.
7059
*/
7160
function types(cb) {
72-
var types = this.rule.type.slice(0)
61+
var list = this.rule.type.slice(0)
7362
, i
7463
, type
7564
, length = this.errors.length
@@ -78,8 +67,8 @@ module.exports = function() {
7867
if(this.validates()) {
7968
this.required();
8069

81-
for(i = 0;i < types.length;i++) {
82-
type = types[i];
70+
for(i = 0;i < list.length;i++) {
71+
type = list[i];
8372
delete this.rule.Type;
8473
if(typeof type === 'function') {
8574
this.rule.Type = type;

0 commit comments

Comments
 (0)