Added eslint to the build

Fixes #102
This commit is contained in:
Colin Eberhardt
2015-08-11 16:52:57 +01:00
parent 74925f4439
commit 401f473449
7 changed files with 56 additions and 61 deletions

View File

@@ -140,8 +140,8 @@ var JavaTranspiler = {
var allTestsInJava = [];
for (var i = 0; i < allTestsInC.length; i++) {
allTestsInJava[i] =
" @Test\n" +
" public void testCase" + i + "()\n" +
' @Test\n' +
' public void testCase' + i + '()\n' +
__transpileSingleTestToJava(allTestsInC[i]);
}
return allTestsInJava.join('\n\n');

View File

@@ -6,7 +6,7 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
/* globals document, computeLayout */
/* globals document, computeLayout, navigator */
var layoutTestUtils = (function() {
@@ -415,7 +415,7 @@ var layoutTestUtils = (function() {
// Note(prenaux): Clearly not what I would like, but it seems to be the only
// way :( My guess is that since the font on Windows is
// different than on OSX it has a different size.
if (typeof navigator !== 'undefined' && navigator.userAgent.indexOf("Windows NT") > -1) {
if (typeof navigator !== 'undefined' && navigator.userAgent.indexOf('Windows NT') > -1) {
preDefinedTextSizes.bigHeight = 36;
}
@@ -450,7 +450,7 @@ var layoutTestUtils = (function() {
testNamedLayout('expected-dom', expectedLayout, domLayout);
testNamedLayout('layout-dom', layout, domLayout);
},
testLayoutAgainstDomOnly: function(node, expectedLayout) {
testLayoutAgainstDomOnly: function(node) {
var layout = computeCSSLayout(node);
var domLayout = computeDOMLayout(node);
inplaceRoundNumbersInObject(layout);

View File

@@ -2122,7 +2122,7 @@ describe('Layout', function() {
{style: {width: 400, height: 400}, children: [
{style: {position: 'absolute', top: 100, left: 100, right: 100, bottom: 100, padding: 10}, children: [
{style: {position: 'absolute', top: 10, left: 10, right: 10, bottom: 10}}
]},
]}
]},
{width: 400, height: 400, top: 0, left: 0, children: [
{width: 200, height: 200, top: 100, left: 100, children: [
@@ -2137,7 +2137,7 @@ describe('Layout', function() {
{style: {width: 400, height: 400}, children: [
{style: {position: 'absolute', top: 100, left: 100, right: 100, bottom: 100, padding: 10, borderWidth: 1}, children: [
{style: {position: 'absolute', top: 10, left: 10, right: 10, bottom: 10}}
]},
]}
]},
{width: 400, height: 400, top: 0, left: 0, children: [
{width: 200, height: 200, top: 100, left: 100, children: [
@@ -2152,7 +2152,7 @@ describe('Layout', function() {
{style: {width: 400, height: 400}, children: [
{style: {flex: 1, padding: 10}, children: [
{style: {position: 'absolute', top: 10, left: 10, right: 10, bottom: 10}}
]},
]}
]},
{width: 400, height: 400, top: 0, left: 0, children: [
{width: 400, height: 400, top: 0, left: 0, children: [
@@ -2195,7 +2195,7 @@ describe('Layout', function() {
{style: {width: 100, height: 100}},
{style: {width: 100, height: 100}},
{style: {width: 100, height: 100}},
{style: {width: 100, height: 100}},
{style: {width: 100, height: 100}}
]},
{width: 320, height: 200, top: 0, left: 0, children: [
{width: 100, height: 100, top: 0, left: 0},
@@ -2203,7 +2203,7 @@ describe('Layout', function() {
{width: 100, height: 100, top: 0, left: 220},
{width: 100, height: 100, top: 100, left: 0},
{width: 100, height: 100, top: 100, left: 110},
{width: 100, height: 100, top: 100, left: 220},
{width: 100, height: 100, top: 100, left: 220}
]}
);
});
@@ -2330,24 +2330,24 @@ describe('Layout alignContent', function() {
testLayout(
{style: {width: 300, height: 380, flexDirection: 'row', flexWrap: 'wrap', alignContent: 'stretch', alignItems: 'flex-start'},
children: [
/* 0 */ {style: {width: 50, height: 50, margin: 10}},
/* 1 */ {style: {width: 50, height: 50, margin: 10}},
/* 2 */ {style: {width: 50, height: 50, margin: 10}},
/* 3 */ {style: {width: 50, height: 50, margin: 10}},
/* 4 */ {style: {width: 50, height: 100, margin: 10}},
/* 5 */ {style: {width: 50, height: 50, margin: 10, alignSelf: 'flex-start'}},
/* 6 */ {style: {width: 50, height: 50, margin: 10}},
/* 7 */ {style: {width: 50, height: 100, margin: 10}},
/* 8 */ {style: {width: 50, height: 50, margin: 10}},
/* 9 */ {style: {width: 50, height: 50, margin: 10}},
/* 0 */ {style: {width: 50, height: 50, margin: 10}},
/* 1 */ {style: {width: 50, height: 50, margin: 10}},
/* 2 */ {style: {width: 50, height: 50, margin: 10}},
/* 3 */ {style: {width: 50, height: 50, margin: 10}},
/* 4 */ {style: {width: 50, height: 100, margin: 10}},
/* 5 */ {style: {width: 50, height: 50, margin: 10, alignSelf: 'flex-start'}},
/* 6 */ {style: {width: 50, height: 50, margin: 10}},
/* 7 */ {style: {width: 50, height: 100, margin: 10}},
/* 8 */ {style: {width: 50, height: 50, margin: 10}},
/* 9 */ {style: {width: 50, height: 50, margin: 10}},
/* 10 */ {style: {width: 50, height: 50, margin: 10, alignSelf: 'flex-start' }},
/* 11 */ {style: {width: 50, height: 50, margin: 10}},
/* 12 */ {style: {width: 50, height: 50, margin: 10}},
/* 13 */ {style: {width: 50, height: 50, margin: 10, alignSelf: 'flex-start'}},
/* 14 */ {style: {width: 50, height: 50, margin: 10}},
],
/* 14 */ {style: {width: 50, height: 50, margin: 10}}
]
},
{width: 300, height: 380, top: 0, left: 0, children: [
{width: 300, height: 380, top: 0, left: 0, children: [
{width: 50, height: 50, top: 10, left: 10},
{width: 50, height: 50, top: 10, left: 80},
{width: 50, height: 50, top: 10, left: 150},
@@ -2373,22 +2373,22 @@ describe('Layout alignContent', function() {
testLayoutAgainstDomOnly(
{style: {width: 300, height: 380, flexDirection: 'row', flexWrap: 'wrap', alignContent: alignContent, alignItems: alignItems},
children: [
/* 0 */ {style: {width: 50, height: 50, margin: 10}},
/* 1 */ {style: {width: 50, height: 50, margin: 10}},
/* 2 */ {style: {width: 50, height: 50, margin: 10}},
/* 3 */ {style: {width: 50, height: 50, margin: 10}},
/* 4 */ {style: {width: 50, height: 100, margin: 10}},
/* 5 */ {style: {width: 50, height: 50, margin: 10, alignSelf: 'flex-start'}},
/* 6 */ {style: {width: 50, height: 50, margin: 10}},
/* 7 */ {style: {width: 50, height: 100, margin: 10}},
/* 8 */ {style: {width: 50, height: 50, margin: 10}},
/* 9 */ {style: {width: 50, height: 50, margin: 10}},
/* 0 */ {style: {width: 50, height: 50, margin: 10}},
/* 1 */ {style: {width: 50, height: 50, margin: 10}},
/* 2 */ {style: {width: 50, height: 50, margin: 10}},
/* 3 */ {style: {width: 50, height: 50, margin: 10}},
/* 4 */ {style: {width: 50, height: 100, margin: 10}},
/* 5 */ {style: {width: 50, height: 50, margin: 10, alignSelf: 'flex-start'}},
/* 6 */ {style: {width: 50, height: 50, margin: 10}},
/* 7 */ {style: {width: 50, height: 100, margin: 10}},
/* 8 */ {style: {width: 50, height: 50, margin: 10}},
/* 9 */ {style: {width: 50, height: 50, margin: 10}},
/* 10 */ {style: {width: 50, height: 50, margin: 10, alignSelf: 'flex-start' }},
/* 11 */ {style: {width: 50, height: 50, margin: 10}},
/* 12 */ {style: {width: 50, height: 50, margin: 10}},
/* 13 */ {style: {width: 50, height: 50, margin: 10, alignSelf: 'flex-start'}},
/* 14 */ {style: {width: 50, height: 50, margin: 10}},
],
/* 14 */ {style: {width: 50, height: 50, margin: 10}}
]
}
);
});

View File

@@ -20,7 +20,7 @@ global.layoutTestUtils = {
testLayout: function(node, expectedLayout) {
allTests.push({name: currentTest, node: node, expectedLayout: expectedLayout});
},
testLayoutAgainstDomOnly: function(node) {
testLayoutAgainstDomOnly: function() {
},
testRandomLayout: function(node, i) {
allTests.push({name: 'Random #' + i, node: node, expectedLayout: computeDOMLayout(node)});
@@ -272,15 +272,14 @@ function transpileAnnotatedJStoC(jsCode) {
}
function makeConstDefs() {
/* eslint no-multi-spaces: 3 */
var lines = [
'#define SMALL_WIDTH ' + layoutTestUtils.textSizes.smallWidth,
'#define SMALL_HEIGHT ' + layoutTestUtils.textSizes.smallHeight,
'#define BIG_WIDTH ' + layoutTestUtils.textSizes.bigWidth,
'#define BIG_HEIGHT ' + layoutTestUtils.textSizes.bigHeight,
'#define SMALL_WIDTH ' + layoutTestUtils.textSizes.smallWidth,
'#define SMALL_HEIGHT ' + layoutTestUtils.textSizes.smallHeight,
'#define BIG_WIDTH ' + layoutTestUtils.textSizes.bigWidth,
'#define BIG_HEIGHT ' + layoutTestUtils.textSizes.bigHeight,
'#define BIG_MIN_WIDTH ' + layoutTestUtils.textSizes.bigMinWidth,
'#define SMALL_TEXT "' + layoutTestUtils.texts.small + '"',
'#define LONG_TEXT "' + layoutTestUtils.texts.big + '"'
'#define SMALL_TEXT "' + layoutTestUtils.texts.small + '"',
'#define LONG_TEXT "' + layoutTestUtils.texts.big + '"'
];
return lines.join('\n');
}