Skip to content

Commit cb49492

Browse files
committed
lint whitespace
- use spaces - remove space before paren in function - remove space before colon in object
1 parent 74726f0 commit cb49492

5 files changed

Lines changed: 31 additions & 31 deletions

File tree

docs/extractCode.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,33 @@ var CODE_SAMPLE = /```[\S]+\s*[\s\S]*?```/g;
55
var PARTS = /```[\S]+\s*\/\/\s+(.+?)\n([\s\S]*?)```/;
66

77
function truncate(s, n) {
8-
n = n || 256
9-
if (s.length < n) {
10-
return s;
11-
}
12-
return s.substring(0, n) + '...';
8+
n = n || 256
9+
if (s.length < n) {
10+
return s;
11+
}
12+
return s.substring(0, n) + '...';
1313
}
1414

1515
function main(dest, filenames) {
16-
if (!dest) {
17-
throw new Error('no dest provided');
18-
}
19-
filenames.map(function (filename) {
20-
var content = fs.readFileSync(filename).toString('utf8');
21-
var codeSamples = content.match(CODE_SAMPLE);
16+
if (!dest) {
17+
throw new Error('no dest provided');
18+
}
19+
filenames.map(function(filename) {
20+
var content = fs.readFileSync(filename).toString('utf8');
21+
var codeSamples = content.match(CODE_SAMPLE);
2222

23-
codeSamples.map(function (codeSample) {
24-
// Do a little jank preprocessing
25-
codeSample = codeSample.replace('<!--', '//').replace(' -->', '');
26-
var extracted = codeSample.match(PARTS);
27-
if (!extracted) {
28-
throw new Error('Code sample did not match correct format in ' + filename + ': ' + truncate(codeSample));
29-
}
30-
var filename = extracted[1];
31-
var content = extracted[2].replace(/\*\*/g, '');
32-
fs.writeFileSync(argv.dest + '/' + filename, content);
33-
});
23+
codeSamples.map(function(codeSample) {
24+
// Do a little jank preprocessing
25+
codeSample = codeSample.replace('<!--', '//').replace(' -->', '');
26+
var extracted = codeSample.match(PARTS);
27+
if (!extracted) {
28+
throw new Error('Code sample did not match correct format in ' + filename + ': ' + truncate(codeSample));
29+
}
30+
var filename = extracted[1];
31+
var content = extracted[2].replace(/\*\*/g, '');
32+
fs.writeFileSync(argv.dest + '/' + filename, content);
3433
});
34+
});
3535
}
3636

37-
main(argv.dest, argv._);
37+
main(argv.dest, argv._);

src/test/mocks.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ function makeComponent(metadata) {
116116
f._isMockFunction = true;
117117

118118
f.mock = {
119-
calls : calls,
120-
instances : instances
119+
calls: calls,
120+
instances: instances
121121
};
122122

123123
f.mockClear = function() {
@@ -218,7 +218,7 @@ function _getMetadata(component, _refs) {
218218
return null;
219219
}
220220

221-
var metadata = {type : type};
221+
var metadata = {type: type};
222222
if (type == 'constant') {
223223
metadata.value = component;
224224
return metadata;

vendor/fbtransform/syntax.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ function runCli(argv) {
5757
var source = '';
5858
process.stdin.resume();
5959
process.stdin.setEncoding('utf8');
60-
process.stdin.on('data', function (chunk) {
60+
process.stdin.on('data', function(chunk) {
6161
source += chunk;
6262
});
63-
process.stdin.on('end', function () {
63+
process.stdin.on('end', function() {
6464
try {
6565
source = transformAll(source, options, excludes);
6666
} catch (e) {

vendor/fbtransform/transforms/__tests__/react-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ describe('react jsx', function() {
338338

339339
it('should not throw for unknown hyphenated tags', function() {
340340
var code = '<x-component />;';
341-
expect(function(){transform(code);}).not.toThrow();
341+
expect(function() {transform(code);}).not.toThrow();
342342
});
343343

344344
it('calls assign with a new target object for spreads', function() {

vendor/fbtransform/transforms/xjs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ function renderXJSLiteral(object, isLast, state, start, end) {
2020

2121
var lastNonEmptyLine = 0;
2222

23-
lines.forEach(function (line, index) {
23+
lines.forEach(function(line, index) {
2424
if (line.match(/[^ \t]/)) {
2525
lastNonEmptyLine = index;
2626
}
2727
});
2828

29-
lines.forEach(function (line, index) {
29+
lines.forEach(function(line, index) {
3030
var isFirstLine = index === 0;
3131
var isLastLine = index === lines.length - 1;
3232
var isLastNonEmptyLine = index === lastNonEmptyLine;

0 commit comments

Comments
 (0)