Skip to content

Commit 334c14d

Browse files
Introduces Prettier and reformats source
1 parent 72bfdc6 commit 334c14d

22 files changed

+2420
-247
lines changed

.editorconfig

Lines changed: 0 additions & 10 deletions
This file was deleted.

.eslintrc.js

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,15 @@ module.exports = {
1313
"node": true
1414
},
1515

16+
"parserOptions": {
17+
"ecmaVersion": 2017
18+
},
19+
1620
"extends": "eslint:recommended",
1721

1822
"rules": {
19-
"indent": [
20-
"error",
21-
"tab"
22-
],
23-
24-
"linebreak-style": [
25-
"error",
26-
"unix"
27-
],
28-
29-
"quotes": [
30-
"error",
31-
"single"
32-
],
33-
34-
"semi": [
35-
"error",
36-
"always"
37-
],
38-
3923
"no-console": "off",
40-
"no-var": "error"
24+
"no-var": "error",
25+
"comma-dangle": ["error", "always-multiline"],
4126
}
42-
};
27+
};

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"trailingComma": "all",
3+
"tabWidth": 2,
4+
"endOfLine": "lf",
5+
"singleQuote": true
6+
}

lib/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,12 @@ module.exports = {
5959
this._cleanup(!!appServerOptions);
6060
return isInvalid;
6161
})
62-
.then(isInvalid => isCliRun ? this._exit(isInvalid, failHard) : isInvalid)
62+
.then(isInvalid =>
63+
isCliRun ? this._exit(isInvalid, failHard) : isInvalid,
64+
)
6365
.catch(e => {
6466
console.error(e);
6567
this._exit(true, failHard);
6668
});
67-
}
68-
};
69+
},
70+
};

lib/intro.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ const logo = `
99
module.exports = function intro() {
1010
console.log(logo);
1111
console.info('Validating URLs from valimate.json...\n');
12-
};
12+
};

lib/localAppServer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ module.exports = {
2929

3030
stop() {
3131
this.server.kill();
32-
}
33-
};
32+
},
33+
};

lib/mergeConfig.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ function mergeConfig(userConfig) {
44
const defaults = {
55
failHard: true,
66
validatorUrl: 'https://validator.w3.org/nu/',
7-
localAppServer: null
7+
localAppServer: null,
88
};
99

1010
return Object.assign(defaults, userConfig);
1111
}
1212

13-
14-
module.exports = mergeConfig;
13+
module.exports = mergeConfig;

lib/models/Result.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ module.exports = class Result {
1919
get errors() {
2020
return this[messages].filter(m => m.type === 'error');
2121
}
22-
};
22+
};

lib/models/tests/Result-tests.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,22 @@ const data = `{
3636

3737
const result = new Result(null, data);
3838

39-
describe('the Result class', function () {
40-
describe('the info property', function () {
41-
it('should only return messages of the info type', function () {
39+
describe('the Result class', function() {
40+
describe('the info property', function() {
41+
it('should only return messages of the info type', function() {
4242
expect(result.info.length).to.equal(4);
4343
});
4444
});
4545

46-
describe('the warnings property', function () {
47-
it('should only return messages of the warnings type', function () {
46+
describe('the warnings property', function() {
47+
it('should only return messages of the warnings type', function() {
4848
expect(result.warnings.length).to.equal(2);
4949
});
5050
});
5151

52-
describe('the errors property', function () {
53-
it('should only return messages of the errors type', function () {
52+
describe('the errors property', function() {
53+
it('should only return messages of the errors type', function() {
5454
expect(result.errors.length).to.equal(1);
5555
});
5656
});
57-
});
57+
});

lib/resultsPrinter.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,17 @@ module.exports = {
3030

3131
if (warnings.length) {
3232
console.log(`${YELLOW}${warnings.length} warnings:`);
33-
console.log(warnings.map(warning => this._mapWithDetails(warning)).join(JOINER));
33+
console.log(
34+
warnings.map(warning => this._mapWithDetails(warning)).join(JOINER),
35+
);
3436
}
3537

3638
if (errors.length) {
3739
console.log(`${RED}${errors.length} errors:`);
38-
console.log(RED + result.errors.map(error => this._mapWithDetails(error)).join(JOINER));
40+
console.log(
41+
RED +
42+
result.errors.map(error => this._mapWithDetails(error)).join(JOINER),
43+
);
3944
}
4045

4146
console.log(NORMAL + JOINER);
@@ -46,6 +51,8 @@ module.exports = {
4651
},
4752

4853
_mapWithDetails(item) {
49-
return `${this._map(item)} - Line ${item.lastLine}, Column ${item.lastColumn}`;
50-
}
51-
};
54+
return `${this._map(item)} - Line ${item.lastLine}, Column ${
55+
item.lastColumn
56+
}`;
57+
},
58+
};

0 commit comments

Comments
 (0)