Skip to content

Commit 58ee3f1

Browse files
author
Mark
committed
Use Prettier
1 parent d772392 commit 58ee3f1

16 files changed

+674
-188
lines changed

.babelrc.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ module.exports = {
77
useBuiltIns: 'usage',
88
corejs: 3,
99
targets: {
10-
browsers: ['last 2 versions', 'ie >= 11']
11-
}
12-
}
13-
]
14-
]
10+
browsers: ['last 2 versions', 'ie >= 11'],
11+
},
12+
},
13+
],
14+
],
1515
};

.huskyrc.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
hooks: {
3+
'pre-commit': 'pretty-quick --staged',
4+
},
5+
};

.prettierignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
dist/
2-
package*.json
2+
package*.json
3+
.coverage/
4+
.*ignore
5+
.npmrc
6+
LICENSE

.prettierrc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
module.exports = {
22
singleQuote: true,
33
tabWidth: 4,
4-
printWidth: 120
54
};

.release-it.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ module.exports = {
33
commitMessage: '${version}',
44
requireCleanWorkingDir: false,
55
requireUpstream: false,
6-
tagName: 'v${version}'
6+
tagName: 'v${version}',
77
},
88
github: {
99
release: true,
1010
releaseName: '${version}',
11-
releaseNotes: null
11+
releaseNotes: null,
1212
},
1313
hooks: {
1414
'after:bump': 'npm run build',
15-
'before:init': ['npm test']
16-
}
15+
'before:init': ['npm test'],
16+
},
1717
};

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@ You can listen to route changes that are triggered either by link clicks or via
145145
```html
146146
<html>
147147
<head>
148-
<script type="module" src="node_modules/router-component/dist/router-component.js"></script>
148+
<script
149+
type="module"
150+
src="node_modules/router-component/dist/router-component.js"
151+
></script>
149152
<script type="module">
150153
const router = document.body.querySelector('router-component');
151154
router.addEventListener('route-changed', () => {

examples/dynamic-routing/index.html

Lines changed: 53 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,56 @@
11
<html>
2-
<head>
3-
<base href="/examples/dynamic-routing/" />
4-
<style>
5-
header {
6-
display: flex;
7-
width: 100vw;
8-
background-color: #f1f1f1;
9-
}
2+
<head>
3+
<base href="/examples/dynamic-routing/" />
4+
<style>
5+
header {
6+
display: flex;
7+
width: 100vw;
8+
background-color: #f1f1f1;
9+
}
1010

11-
header ul {
12-
display: flex;
13-
list-style: none;
14-
margin: 0;
15-
padding: 0;
16-
}
11+
header ul {
12+
display: flex;
13+
list-style: none;
14+
margin: 0;
15+
padding: 0;
16+
}
1717

18-
header ul li {
19-
padding: 10px;
20-
}
21-
22-
</style>
23-
<script type="module" src="../../dist/router-component.js"></script>
24-
<script type="module" src="home-page.js"></script>
25-
<script type="module" src="the-first-page.js"></script>
26-
<script type="module" src="page-number-too.js"></script>
27-
<script type="module" src="third-page/index.js"></script>
28-
<script type="module" src="third-page/third-nested-page.js"></script>
29-
<script type="module" src="four-oh-four-page.js"></script>
30-
31-
</head>
32-
<body>
33-
34-
<header>
35-
<ul>
36-
<li><a href="page1?foo=bar">Page 1</a></li>
37-
<li><a href="second/page/851/johnDoe/">Page 2</a></li>
38-
<li><a href="my/page/3/">Page 3</a></li>
39-
<li><a href="my/page/3/nested/page">Nested Page 4</a></li>
40-
<li><a href="wrong">Wrong Page</a></li>
41-
</ul>
42-
</header>
43-
<router-component>
44-
<home-page path="dynamic-routing/$"></home-page>
45-
<the-first-page path="page1" search-params="foo=[bar|baz]"></the-first-page>
46-
<page-number-too path="/second/page/([0-9]+)/([a-zA-Z]+)/?"></page-number-too>
47-
<third-page path="/my/page/3/$"></third-page>
48-
<third-nested-page path="/my/page/3/nested/page"></third-nested-page>
49-
<four-oh-four-page path=".*"></four-oh-four-page>
50-
</router-component>
51-
52-
</body>
53-
</html>
18+
header ul li {
19+
padding: 10px;
20+
}
21+
</style>
22+
<script type="module" src="../../dist/router-component.js"></script>
23+
<script type="module" src="home-page.js"></script>
24+
<script type="module" src="the-first-page.js"></script>
25+
<script type="module" src="page-number-too.js"></script>
26+
<script type="module" src="third-page/index.js"></script>
27+
<script type="module" src="third-page/third-nested-page.js"></script>
28+
<script type="module" src="four-oh-four-page.js"></script>
29+
</head>
30+
<body>
31+
<header>
32+
<ul>
33+
<li><a href="page1?foo=bar">Page 1</a></li>
34+
<li><a href="second/page/851/johnDoe/">Page 2</a></li>
35+
<li><a href="my/page/3/">Page 3</a></li>
36+
<li><a href="my/page/3/nested/page">Nested Page 4</a></li>
37+
<li><a href="wrong">Wrong Page</a></li>
38+
</ul>
39+
</header>
40+
<router-component>
41+
<home-page path="dynamic-routing/$"></home-page>
42+
<the-first-page
43+
path="page1"
44+
search-params="foo=[bar|baz]"
45+
></the-first-page>
46+
<page-number-too
47+
path="/second/page/([0-9]+)/([a-zA-Z]+)/?"
48+
></page-number-too>
49+
<third-page path="/my/page/3/$"></third-page>
50+
<third-nested-page
51+
path="/my/page/3/nested/page"
52+
></third-nested-page>
53+
<four-oh-four-page path=".*"></four-oh-four-page>
54+
</router-component>
55+
</body>
56+
</html>

examples/nested-tabs/index.html

Lines changed: 44 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,42 @@
11
<html>
2-
<head>
3-
<base href="/examples/nested-tabs/" />
4-
<style>
5-
body {
6-
display: flex;
7-
}
8-
9-
tab-page {
10-
display: flex;
11-
flex-direction: column;
12-
}
13-
</style>
14-
<script type="module" src="../../dist/router-component.js"></script>
15-
16-
<script>
17-
customElements.define('tab-one', class extends HTMLElement {
18-
connectedCallback() {
19-
this.innerHTML = 'tab one!';
2+
<head>
3+
<base href="/examples/nested-tabs/" />
4+
<style>
5+
body {
6+
display: flex;
207
}
21-
})
228

23-
customElements.define('tab-two', class extends HTMLElement {
24-
connectedCallback() {
25-
this.innerHTML = 'tab two!';
9+
tab-page {
10+
display: flex;
11+
flex-direction: column;
2612
}
27-
})
13+
</style>
14+
<script type="module" src="../../dist/router-component.js"></script>
15+
16+
<script>
17+
customElements.define(
18+
'tab-one',
19+
class extends HTMLElement {
20+
connectedCallback() {
21+
this.innerHTML = 'tab one!';
22+
}
23+
}
24+
);
25+
26+
customElements.define(
27+
'tab-two',
28+
class extends HTMLElement {
29+
connectedCallback() {
30+
this.innerHTML = 'tab two!';
31+
}
32+
}
33+
);
2834

29-
customElements.define('tab-page', class extends HTMLElement {
30-
connectedCallback() {
31-
this.innerHTML = `
35+
customElements.define(
36+
'tab-page',
37+
class extends HTMLElement {
38+
connectedCallback() {
39+
this.innerHTML = `
3240
<nav>
3341
<a href="tabs/one">Tab 1</a>
3442
<a href="tabs/two">Tab 2</a>
@@ -38,15 +46,14 @@
3846
<tab-two path="tabs/two"></tab-two>
3947
</router-component>
4048
`;
41-
}
42-
})
43-
</script>
44-
</head>
45-
<body>
46-
47-
<router-component>
48-
<tab-page path="nested-tabs/?$"></tab-page>
49-
</router-component>
50-
51-
</body>
49+
}
50+
}
51+
);
52+
</script>
53+
</head>
54+
<body>
55+
<router-component>
56+
<tab-page path="nested-tabs/?$"></tab-page>
57+
</router-component>
58+
</body>
5259
</html>
Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,28 @@
11
<html>
2-
<head>
3-
<base href="/examples/pages-with-sidebar/" />
4-
<style>
5-
body {
6-
display: flex;
7-
}
2+
<head>
3+
<base href="/examples/pages-with-sidebar/" />
4+
<style>
5+
body {
6+
display: flex;
7+
}
88

9-
the-sidebar {
10-
background: rgb(211, 211, 211);
11-
width: 190px;
12-
display: flex;
13-
flex-direction: column;
14-
}
15-
16-
</style>
17-
<script type="module" src="../../dist/router-component.js"></script>
18-
<script type="module" src="./home-page.js"></script>
19-
<script type="module" src="./second-page.js"></script>
20-
<script type="module" src="the-sidebar.js"></script>
21-
22-
</head>
23-
<body>
24-
25-
<the-sidebar></the-sidebar>
26-
<router-component>
27-
<second-page path="page/2"></second-page>
28-
<home-page path=".*"></home-page>
29-
</router-component>
30-
31-
</body>
9+
the-sidebar {
10+
background: rgb(211, 211, 211);
11+
width: 190px;
12+
display: flex;
13+
flex-direction: column;
14+
}
15+
</style>
16+
<script type="module" src="../../dist/router-component.js"></script>
17+
<script type="module" src="./home-page.js"></script>
18+
<script type="module" src="./second-page.js"></script>
19+
<script type="module" src="the-sidebar.js"></script>
20+
</head>
21+
<body>
22+
<the-sidebar></the-sidebar>
23+
<router-component>
24+
<second-page path="page/2"></second-page>
25+
<home-page path=".*"></home-page>
26+
</router-component>
27+
</body>
3228
</html>

karma.conf.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
1-
module.exports = function(config) {
1+
module.exports = function (config) {
22
config.set({
33
files: [{ pattern: 'tests/**/*.ts', type: 'module' }],
44

5-
plugins: [require.resolve('@open-wc/karma-esm'), 'karma-mocha', 'karma-chrome-launcher', 'karma-coverage'],
5+
plugins: [
6+
require.resolve('@open-wc/karma-esm'),
7+
'karma-mocha',
8+
'karma-chrome-launcher',
9+
'karma-coverage',
10+
],
611
esm: {
712
nodeResolve: true,
813
compatibility: 'min',
914
fileExtensions: ['.ts'],
10-
babel: true
15+
babel: true,
1116
},
1217
coverageReporter: {
1318
includeAllSources: true,
1419
dir: '.coverage',
15-
reporters: [{ type: 'lcov', subdir: '.' }, { type: 'text-summary' }]
20+
reporters: [
21+
{ type: 'lcov', subdir: '.' },
22+
{ type: 'text-summary' },
23+
],
1624
},
1725
reporters: ['progress', 'coverage'],
1826
frameworks: ['esm', 'mocha'],
@@ -22,6 +30,6 @@ module.exports = function(config) {
2230
browsers: ['ChromeHeadless'],
2331
autoWatch: true,
2432
singleRun: true,
25-
concurrency: Infinity
33+
concurrency: Infinity,
2634
});
2735
};

0 commit comments

Comments
 (0)