Skip to content

Commit c6f5313

Browse files
committed
[Tests] add eclint and eslint, to enforce a consistent style
1 parent 45788a5 commit c6f5313

Some content is hidden

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

52 files changed

+720
-658
lines changed

.editorconfig

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 4
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
max_line_length = 140
11+
block_comment_start = /*
12+
block_comment = *
13+
block_comment_end = */
14+
15+
[*.md]
16+
indent_style = space
17+
indent_size = 4
18+
19+
[readme.markdown]
20+
indent_size = off
21+
max_line_length = off
22+
23+
[*.json]
24+
max_line_length = off
25+
26+
[*.yml]
27+
max_line_length = off
28+
29+
[Makefile]
30+
max_line_length = off
31+
32+
[.travis.yml]
33+
indent_size = 2

.eslintrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"root": true,
3+
"rules": {
4+
"indent": ["error", 4],
5+
},
6+
}

.travis.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
language: node_js
2-
sudo: false
2+
os:
3+
- linux
34
node_js:
5+
- "10"
46
- "9"
57
- "8"
68
- "7"
@@ -12,11 +14,23 @@ node_js:
1214
- "0.10"
1315
- "0.8"
1416
before_install:
17+
- 'case "${TRAVIS_NODE_VERSION}" in 0.*) export NPM_CONFIG_STRICT_SSL=false ;; esac'
1518
- 'nvm install-latest-npm'
1619
install:
1720
- 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ] || [ "${TRAVIS_NODE_VERSION}" = "0.9" ]; then nvm install --latest-npm 0.8 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;'
21+
script:
22+
- 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi'
23+
- 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi'
24+
- 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi'
25+
- 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi'
26+
sudo: false
27+
env:
28+
- TEST=true
1829
matrix:
1930
fast_finish: true
31+
include:
32+
- node_js: "lts/*"
33+
env: PRETEST=true
2034
allow_failures:
2135
- node_js: "9"
2236
- node_js: "7"

bin/tape

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ if (typeof opts.require === 'string') {
1919

2020
opts.require.forEach(function(module) {
2121
if (module) {
22-
/* This check ensures we ignore `-r ""`, trailing `-r`, or
23-
* other silly things the user might (inadvertently) be doing. */
24-
require(resolveModule(module, { basedir: cwd }));
22+
/* This check ensures we ignore `-r ""`, trailing `-r`, or
23+
* other silly things the user might (inadvertently) be doing.
24+
*/
25+
require(resolveModule(module, { basedir: cwd }));
2526
}
2627
});
2728

@@ -31,7 +32,7 @@ opts._.forEach(function (arg) {
3132
var files = glob.sync(arg);
3233

3334
if (!Array.isArray(files)) {
34-
throw new TypeError('unknown error: glob.sync did not return an array or throw. Please report this.');
35+
throw new TypeError('unknown error: glob.sync did not return an array or throw. Please report this.');
3536
}
3637

3738
files.forEach(function (file) {

example/array.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@ var test = require('../');
33

44
test('array', function (t) {
55
t.plan(5);
6-
6+
77
var src = '(' + function () {
88
var xs = [ 1, 2, [ 3, 4 ] ];
99
var ys = [ 5, 6 ];
1010
g([ xs, ys ]);
1111
} + ')()';
12-
12+
1313
var output = falafel(src, function (node) {
1414
if (node.type === 'ArrayExpression') {
1515
node.update('fn(' + node.source() + ')');
1616
}
1717
});
18-
18+
1919
var arrays = [
2020
[ 3, 4 ],
2121
[ 1, 2, [ 3, 4 ] ],
2222
[ 5, 6 ],
2323
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ],
2424
];
25-
25+
2626
Function(['fn','g'], output)(
2727
function (xs) {
2828
t.same(arrays.shift(), xs);

example/fail.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@ var test = require('../');
33

44
test('array', function (t) {
55
t.plan(5);
6-
6+
77
var src = '(' + function () {
88
var xs = [ 1, 2, [ 3, 4 ] ];
99
var ys = [ 5, 6 ];
1010
g([ xs, ys ]);
1111
} + ')()';
12-
12+
1313
var output = falafel(src, function (node) {
1414
if (node.type === 'ArrayExpression') {
1515
node.update('fn(' + node.source() + ')');
1616
}
1717
});
18-
18+
1919
var arrays = [
2020
[ 3, 4 ],
2121
[ 1, 2, [ 3, 4 ] ],
2222
[ 5, 6 ],
2323
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ],
2424
];
25-
25+
2626
Function(['fn','g'], output)(
2727
function (xs) {
2828
t.same(arrays.shift(), xs);

example/nested.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,35 @@ var test = require('../');
33

44
test('nested array test', function (t) {
55
t.plan(5);
6-
6+
77
var src = '(' + function () {
88
var xs = [ 1, 2, [ 3, 4 ] ];
99
var ys = [ 5, 6 ];
1010
g([ xs, ys ]);
1111
} + ')()';
12-
12+
1313
var output = falafel(src, function (node) {
1414
if (node.type === 'ArrayExpression') {
1515
node.update('fn(' + node.source() + ')');
1616
}
1717
});
18-
18+
1919
t.test('inside test', function (q) {
2020
q.plan(2);
2121
q.ok(true, 'inside ok');
22-
22+
2323
setTimeout(function () {
2424
q.ok(true, 'inside delayed');
2525
}, 3000);
2626
});
27-
27+
2828
var arrays = [
2929
[ 3, 4 ],
3030
[ 1, 2, [ 3, 4 ] ],
3131
[ 5, 6 ],
3232
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ],
3333
];
34-
34+
3535
Function(['fn','g'], output)(
3636
function (xs) {
3737
t.same(arrays.shift(), xs);

example/nested_fail.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,35 @@ var test = require('../');
33

44
test('nested array test', function (t) {
55
t.plan(5);
6-
6+
77
var src = '(' + function () {
88
var xs = [ 1, 2, [ 3, 4 ] ];
99
var ys = [ 5, 6 ];
1010
g([ xs, ys ]);
1111
} + ')()';
12-
12+
1313
var output = falafel(src, function (node) {
1414
if (node.type === 'ArrayExpression') {
1515
node.update('fn(' + node.source() + ')');
1616
}
1717
});
18-
18+
1919
t.test('inside test', function (q) {
2020
q.plan(2);
2121
q.ok(true);
22-
22+
2323
setTimeout(function () {
2424
q.equal(3, 4);
2525
}, 3000);
2626
});
27-
27+
2828
var arrays = [
2929
[ 3, 4 ],
3030
[ 1, 2, [ 3, 4 ] ],
3131
[ 5, 6 ],
3232
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ],
3333
];
34-
34+
3535
Function(['fn','g'], output)(
3636
function (xs) {
3737
t.same(arrays.shift(), xs);

example/not_enough.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@ var test = require('../');
33

44
test('array', function (t) {
55
t.plan(8);
6-
6+
77
var src = '(' + function () {
88
var xs = [ 1, 2, [ 3, 4 ] ];
99
var ys = [ 5, 6 ];
1010
g([ xs, ys ]);
1111
} + ')()';
12-
12+
1313
var output = falafel(src, function (node) {
1414
if (node.type === 'ArrayExpression') {
1515
node.update('fn(' + node.source() + ')');
1616
}
1717
});
18-
18+
1919
var arrays = [
2020
[ 3, 4 ],
2121
[ 1, 2, [ 3, 4 ] ],
2222
[ 5, 6 ],
2323
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ],
2424
];
25-
25+
2626
Function(['fn','g'], output)(
2727
function (xs) {
2828
t.same(arrays.shift(), xs);

example/throw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var test = require('../');
33

44
test('throw', function (t) {
55
t.plan(2);
6-
6+
77
setTimeout(function () {
88
throw new Error('doom');
99
}, 100);

0 commit comments

Comments
 (0)