Skip to content
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

Start linting all test/ files as part of test script #704

Merged
merged 1 commit into from
Aug 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"npm": ">=1.4.0"
},
"scripts": {
"pretest": "eslint mustache.js bin/mustache",
"pretest": "eslint mustache.js bin/mustache test/**/*.js",
"test": "mocha --reporter spec test/*-test.js",
"test-render": "mocha --reporter spec test/render-test",
"pre-test-browser": "node test/create-browser-suite.js",
Expand Down
6 changes: 6 additions & 0 deletions test/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "../.eslintrc",
"rules": {
"func-names": 0
}
}
4 changes: 2 additions & 2 deletions test/_files/ampersand_escape.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
({
message: "Some <code>"
})
message: 'Some <code>'
});
2 changes: 1 addition & 1 deletion test/_files/apostrophe.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
({
'apos': "'",
'control': 'X'
})
});
2 changes: 1 addition & 1 deletion test/_files/array_of_strings.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
({
array_of_strings: ['hello', 'world']
})
});
2 changes: 1 addition & 1 deletion test/_files/avoids_obj_prototype_in_view_cache.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
({
valueOf: 'Avoids methods',
watch: 'in Object.prototype'
})
});
4 changes: 2 additions & 2 deletions test/_files/backslashes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
({
value: "\\abc"
})
value: '\\abc'
});
4 changes: 2 additions & 2 deletions test/_files/bug_11_eating_whitespace.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
({
tag: "yo"
})
tag: 'yo'
});
2 changes: 1 addition & 1 deletion test/_files/bug_length_property.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
({
length: 'hello'
})
});
6 changes: 3 additions & 3 deletions test/_files/changing_delimiters.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
({
"foo": "foooooooooooooo",
"bar": "<b>bar!</b>"
})
'foo': 'foooooooooooooo',
'bar': '<b>bar!</b>'
});
8 changes: 4 additions & 4 deletions test/_files/check_falsy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
({
number: function(text, render) {
return function(text, render) {
number: function (text, render) {
return function (text, render) {
return +render(text);
}
};
}
})
});
4 changes: 2 additions & 2 deletions test/_files/comments.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
({
title: function () {
return "A Comedy of Errors";
return 'A Comedy of Errors';
}
})
});
12 changes: 6 additions & 6 deletions test/_files/complex.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
({
header: function () {
return "Colors";
return 'Colors';
},
item: [
{name: "red", current: true, url: "#Red"},
{name: "green", current: false, url: "#Green"},
{name: "blue", current: false, url: "#Blue"}
{name: 'red', current: true, url: '#Red'},
{name: 'green', current: false, url: '#Green'},
{name: 'blue', current: false, url: '#Blue'}
],
link: function () {
return this["current"] !== true;
return this['current'] !== true;
},
list: function () {
return this.item.length !== 0;
},
empty: function () {
return this.item.length === 0;
}
})
});
10 changes: 5 additions & 5 deletions test/_files/context_lookup.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
({
"outer": {
"id": 1,
"second": {
"nothing": 2
'outer': {
'id': 1,
'second': {
'nothing': 2
}
}
})
});
10 changes: 5 additions & 5 deletions test/_files/delimiters.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
({
first: "It worked the first time.",
second: "And it worked the second time.",
third: "Then, surprisingly, it worked the third time.",
fourth: "Fourth time also fine!."
})
first: 'It worked the first time.',
second: 'And it worked the second time.',
third: 'Then, surprisingly, it worked the third time.',
fourth: 'Fourth time also fine!.'
});
2 changes: 1 addition & 1 deletion test/_files/disappearing_whitespace.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
({
bedrooms: true,
total: 1
})
});
10 changes: 5 additions & 5 deletions test/_files/dot_notation.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
({
name: "A Book",
authors: ["John Power", "Jamie Walsh"],
name: 'A Book',
authors: ['John Power', 'Jamie Walsh'],
price: {
value: 200,
vat: function () {
Expand All @@ -13,12 +13,12 @@
},
availability: {
status: true,
text: "In Stock"
text: 'In Stock'
},
// And now, some truthy false values
truthy: {
zero: 0,
notTrue: false
},
singletonList: [{singletonItem: "singleton item"}]
})
singletonList: [{singletonItem: 'singleton item'}]
});
6 changes: 3 additions & 3 deletions test/_files/double_render.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
({
foo: true,
bar: "{{win}}",
win: "FAIL"
})
bar: '{{win}}',
win: 'FAIL'
});
2 changes: 1 addition & 1 deletion test/_files/empty_list.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
({
jobs: []
})
});
2 changes: 1 addition & 1 deletion test/_files/empty_sections.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
({})
({});
6 changes: 3 additions & 3 deletions test/_files/empty_string.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
({
description: "That is all!",
description: 'That is all!',
child: {
description: ""
description: ''
}
})
});
2 changes: 1 addition & 1 deletion test/_files/empty_template.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
({})
({});
2 changes: 1 addition & 1 deletion test/_files/error_not_found.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
({
bar: 2
})
});
4 changes: 2 additions & 2 deletions test/_files/escaped.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
({
title: function () {
return "Bear > Shark";
return 'Bear > Shark';
},
symbol: null,
entities: "&quot; \"'<>`=/"
})
});
14 changes: 7 additions & 7 deletions test/_files/falsy.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
({
"emptyString": "",
"emptyArray": [],
"zero": 0,
"null": null,
"undefined": undefined,
"NaN": 0/0
})
'emptyString': '',
'emptyArray': [],
'zero': 0,
'null': null,
'undefined': undefined,
'NaN': 0/0
});
16 changes: 8 additions & 8 deletions test/_files/falsy_array.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
({
"list": [
["", "emptyString"],
[[], "emptyArray"],
[0, "zero"],
[null, "null"],
[undefined, "undefined"],
[0/0, "NaN"]
'list': [
['', 'emptyString'],
[[], 'emptyArray'],
[0, 'zero'],
[null, 'null'],
[undefined, 'undefined'],
[0/0, 'NaN']
]
})
});
2 changes: 1 addition & 1 deletion test/_files/grandparent_context.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
]
}
]
})
});
8 changes: 4 additions & 4 deletions test/_files/higher_order_sections.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
({
name: "Tater",
helper: "To tinker?",
name: 'Tater',
helper: 'To tinker?',
bolder: function () {
return function (text, render) {
return text + ' => <b>' + render(text) + '</b> ' + this.helper;
}
};
}
})
});
2 changes: 1 addition & 1 deletion test/_files/implicit_iterator.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
name: 'janl'
}
}
})
});
4 changes: 2 additions & 2 deletions test/_files/included_tag.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
({
html: "I like {{mustache}}"
})
html: 'I like {{mustache}}'
});
4 changes: 2 additions & 2 deletions test/_files/inverted_section.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
({
"repos": []
})
'repos': []
});
6 changes: 3 additions & 3 deletions test/_files/keys_with_questionmarks.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
({
"person?": {
name: "Jon"
'person?': {
name: 'Jon'
}
})
});
2 changes: 1 addition & 1 deletion test/_files/malicious_template.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
({})
({});
2 changes: 1 addition & 1 deletion test/_files/multiline_comment.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
({})
({});
2 changes: 1 addition & 1 deletion test/_files/nested_dot.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
({ name: 'Bruno' })
({ name: 'Bruno' });
2 changes: 1 addition & 1 deletion test/_files/nested_iterating.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
bar: 'bar'
}]
}]
})
});
2 changes: 1 addition & 1 deletion test/_files/nesting.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
{a: {b: 2}},
{a: {b: 3}}
]
})
});
2 changes: 1 addition & 1 deletion test/_files/nesting_same_name.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
items: [1, 2, 3, 4]
}
]
})
});
16 changes: 8 additions & 8 deletions test/_files/null_lookup_array.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
({
"name": "David",
"twitter": "@dasilvacontin",
"farray": [
["Flor", "@florrts"],
["Miquel", null],
["Chris", undefined]
]
})
'name': 'David',
'twitter': '@dasilvacontin',
'farray': [
['Flor', '@florrts'],
['Miquel', null],
['Chris', undefined]
]
});
40 changes: 20 additions & 20 deletions test/_files/null_lookup_object.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
({
"name": "David",
"twitter": "@dasilvacontin",
"fobject": [
'name': 'David',
'twitter': '@dasilvacontin',
'fobject': [
{
"name": "Flor",
"twitter": "@florrts"
'name': 'Flor',
'twitter': '@florrts'
},
{
"name": "Miquel",
"twitter": null
'name': 'Miquel',
'twitter': null
},
{
"name": "Chris",
"twitter": undefined
'name': 'Chris',
'twitter': undefined
}
],
"favorites": {
"color": "blue",
"president": "Bush",
"show": "Futurama"
'favorites': {
'color': 'blue',
'president': 'Bush',
'show': 'Futurama'
},
"mascot": {
"name": "Squid",
"favorites": {
"color": "orange",
"president": undefined,
"show": null
'mascot': {
'name': 'Squid',
'favorites': {
'color': 'orange',
'president': undefined,
'show': null
}
}
})
});
Loading