Skip to content

Commit 3f49947

Browse files
authoredApr 21, 2023
Minor Markdown and lint tweaks (#370)
1 parent 117731e commit 3f49947

19 files changed

+92
-72
lines changed
 

‎.babelrc.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ module.exports = {
77
'@babel/preset-env',
88
{
99
loose: true,
10-
bugfixes: true
11-
}
12-
]
13-
]
10+
bugfixes: true,
11+
},
12+
],
13+
],
1414
};

‎.eslintrc.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ module.exports = {
5757
},
5858
overrides: [
5959
{
60-
'files': [
60+
files: [
6161
'site/**',
6262
],
63-
'parserOptions': {
64-
'sourceType': 'script',
63+
parserOptions: {
64+
sourceType: 'script',
6565
},
66-
'rules': {
66+
rules: {
6767
'require-jsdoc': 'off',
6868
},
6969
},

‎.github/ISSUE_TEMPLATE/bug_report.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,26 @@ labels:
55
---
66

77
**Before you start**
8+
89
Please take a look at the [FAQ](https://github.com/GoogleChromeLabs/quicklink/wiki/FAQ) as well as the already opened issues! If nothing fits your problem, go ahead and fill out the following template:
910

1011
**Describe the bug**
12+
1113
A clear and concise description of what the bug is.
1214

1315
**To Reproduce**
16+
1417
Steps to reproduce the behavior.
1518

1619
**Expected behavior**
20+
1721
A clear and concise description of what you expected to happen.
1822

1923
**Version:**
20-
- OS w/ version: [e.g. iOS 12]
21-
- Browser w/ version [e.g. Chrome 75]
24+
25+
* OS w/ version: [e.g. iOS 12]
26+
* Browser w/ version [e.g. Chrome 75]
2227

2328
**Additional context, screenshots, screencasts**
29+
2430
Add any other context about the problem here.

‎CHANGELOG.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* [site] reorder logos ([09907bb](https://github.com/GoogleChromeLabs/quicklink/commit/09907bb))
1717
* [site] update version ([7babbda](https://github.com/GoogleChromeLabs/quicklink/commit/7babbda))
1818
* Add Magento Quicklink module (Readme + Site) (#216) ([c77e057](https://github.com/GoogleChromeLabs/quicklink/commit/c77e057)), closes [#216](https://github.com/GoogleChromeLabs/quicklink/issues/216)
19-
* Added `threshold` option to allow users select the % of link areas that entered the viewport before ([d3746e1](https://github.com/GoogleChromeLabs/quicklink/commit/d3746e1)), closes [#214](https://github.com/GoogleChromeLabs/quicklink/issues/214)
19+
* Added `threshold` option to allow users select the % of link areas that entered the viewport before ([d3746e1](https://github.com/GoogleChromeLabs/quicklink/commit/d3746e1)), closes [#214](https://github.com/GoogleChromeLabs/quicklink/issues/214)
2020
* Instructions to debug Quicklink ([2b3dc21](https://github.com/GoogleChromeLabs/quicklink/commit/2b3dc21))
2121

2222
## 2.1.0 (2021-02-07)
@@ -74,7 +74,7 @@
7474
* 2.0.0-beta ([185d1e8](https://github.com/GoogleChromeLabs/quicklink/commit/185d1e8))
7575
* Add support for Quicklink 2.0.0-alpha ([7c7c917](https://github.com/GoogleChromeLabs/quicklink/commit/7c7c917))
7676
* Add twitter metadata ([74d3224](https://github.com/GoogleChromeLabs/quicklink/commit/74d3224))
77-
* Adding SPA section to README.md ([ea3229a](https://github.com/GoogleChromeLabs/quicklink/commit/ea3229a))
77+
* Adding SPA section to README.md ([ea3229a](https://github.com/GoogleChromeLabs/quicklink/commit/ea3229a))
7878
* Fix typo on README (#127) ([5acb27e](https://github.com/GoogleChromeLabs/quicklink/commit/5acb27e)), closes [#127](https://github.com/GoogleChromeLabs/quicklink/issues/127)
7979
* package.json: bump version to 2.0.0-alpha ([d5d5ca5](https://github.com/GoogleChromeLabs/quicklink/commit/d5d5ca5))
8080
* Updates to initial site (#144) ([3f796f6](https://github.com/GoogleChromeLabs/quicklink/commit/3f796f6)), closes [#144](https://github.com/GoogleChromeLabs/quicklink/issues/144)
@@ -106,8 +106,8 @@
106106
* Mention instant.page as a related project ([0bc8aec](https://github.com/GoogleChromeLabs/quicklink/commit/0bc8aec))
107107
* Mention Safari ≥ 12.1 working without polyfills (#111) ([b01e5bb](https://github.com/GoogleChromeLabs/quicklink/commit/b01e5bb)), closes [#111](https://github.com/GoogleChromeLabs/quicklink/issues/111)
108108
* remove extraneous full stops / periods from comment (#105) ([23737af](https://github.com/GoogleChromeLabs/quicklink/commit/23737af)), closes [#105](https://github.com/GoogleChromeLabs/quicklink/issues/105)
109-
* remove unneeded type="text/css" from demo (#106) ([4dc74f1](https://github.com/GoogleChromeLabs/quicklink/commit/4dc74f1)), closes [#106](https://github.com/GoogleChromeLabs/quicklink/issues/106)
110-
* remove unneeded type="text/css" from demo page (#104) ([24919bd](https://github.com/GoogleChromeLabs/quicklink/commit/24919bd)), closes [#104](https://github.com/GoogleChromeLabs/quicklink/issues/104)
109+
* remove unneeded type="text/css" from demo (#106) ([4dc74f1](https://github.com/GoogleChromeLabs/quicklink/commit/4dc74f1)), closes [#106](https://github.com/GoogleChromeLabs/quicklink/issues/106)
110+
* remove unneeded type="text/css" from demo page (#104) ([24919bd](https://github.com/GoogleChromeLabs/quicklink/commit/24919bd)), closes [#104](https://github.com/GoogleChromeLabs/quicklink/issues/104)
111111
* Update link to Gatsby with Guess.js (#108) ([dc02d33](https://github.com/GoogleChromeLabs/quicklink/commit/dc02d33)), closes [#108](https://github.com/GoogleChromeLabs/quicklink/issues/108)
112112
* Update microbundle to fix "missing JSX plugin" issue ([8f5cf22](https://github.com/GoogleChromeLabs/quicklink/commit/8f5cf22))
113113
* Update repo path in package.json ([45e9bbd](https://github.com/GoogleChromeLabs/quicklink/commit/45e9bbd))

‎CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Here's an example of how to debug the library by using one of these tests:
4949

5050
```js
5151
<script type="module">
52-
import { listen } from '../../src/index.mjs';
52+
import {listen} from '../../src/index.mjs';
5353
listen();
5454
</script>
5555
```

‎README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ For example, you can initialize after the `load` event fires:
6969
ES Module import:
7070

7171
```js
72-
import { listen, prefetch } from 'quicklink';
72+
import {listen, prefetch} from 'quicklink';
7373
```
7474

7575
## Single page apps (React)
@@ -96,7 +96,7 @@ Wrap your routes with the `withQuicklink()` HOC.
9696
Example:
9797

9898
```jsx
99-
import { withQuicklink } from 'quicklink/dist/react/hoc.js';
99+
import {withQuicklink} from 'quicklink/dist/react/hoc.js';
100100

101101
const options = {
102102
origins: [],
@@ -461,7 +461,7 @@ After installing `quicklink` as a dependency, you can use it as follows:
461461

462462
```html
463463
<script type="module">
464-
import { prefetch } from 'quicklink';
464+
import {prefetch} from 'quicklink';
465465
prefetch(['1.html', '2.html']).catch(err => {
466466
// Handle own errors
467467
});

‎demos/news-workbox/README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
21
# Demo: Quicklink usage with workbox
2+
33
A demo showing how to use Quicklink with Workbox for offline caching and links in the visible viewport.
44

55
## Glitch Source
6+
67
* [Link to Glitch App](https://anton-karlovskiy-quicklink-news-workbox.glitch.me)
78
* [Link to Project on Glitch](https://glitch.com/~anton-karlovskiy-quicklink-news-workbox)
89

910
## Installation
10-
```
11+
12+
```sh
1113
git clone https://api.glitch.com/git/anton-karlovskiy-quicklink-news-workbox
1214
npm install
1315
npm start

‎demos/news/README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
21
# Demo: Quicklink basic usage
2+
33
A demo showing how to use Quicklink on a simple multi-page website.
44

55
## Glitch Source
6+
67
* [Link to Glitch App](https://anton-karlovskiy-quicklink-news.glitch.me)
78
* [Link to Project on Glitch](https://glitch.com/~anton-karlovskiy-quicklink-news)
89

910
## Installation
10-
```
11+
12+
```sh
1113
git clone https://api.glitch.com/git/anton-karlovskiy-quicklink-news
1214
npm install
1315
npm start

‎demos/spa/README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
# Demo: Quicklink integration for create-react-app
2+
23
A demo showing how to use Quicklink with in a create-react-app site.
34
To integrate your React SPA with Quicklink, follow the steps [here](https://github.com/GoogleChromeLabs/quicklink#single-page-apps-react).
45

56
## Glitch Source
7+
68
* [Link to Glitch App](https://create-react-app-quicklink.glitch.me/)
79
* [Link to Project on Glitch](https://glitch.com/~create-react-app-quicklink)
810

911
## Installation
10-
```
12+
13+
```sh
1114
git clone https://api.glitch.com/git/create-react-app-quicklink
1215
npm install
1316
npm start
1417
npm run build
15-
```
18+
```
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"optOut": false,
3-
"lastUpdateCheck": 1574808403652,
4-
"update": {
5-
"latest": "4.3.3",
6-
"current": "2.25.5",
7-
"type": "major",
8-
"name": "pnpm"
9-
}
10-
}
2+
"optOut": false,
3+
"lastUpdateCheck": 1574808403652,
4+
"update": {
5+
"latest": "4.3.3",
6+
"current": "2.25.5",
7+
"type": "major",
8+
"name": "pnpm"
9+
}
10+
}

‎site/firebase.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@
6464
}
6565
]
6666
}
67-
}
67+
}

‎site/src/script.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ window.addEventListener('load', () => {
3030

3131
window.addEventListener('scroll', trackScroll, {passive: true});
3232
goTopBtn.addEventListener('click', backToTop);
33-
};
33+
}
3434

3535
initGoToTopBtn();
3636

‎src/chunks.mjs

+16-11
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
15-
**/
15+
**/
16+
1617
import throttle from 'throttles';
1718
import {priority, supported} from './prefetch.mjs';
1819
import requestIdleCallback from './request-idle-callback.mjs';
@@ -69,10 +70,12 @@ export function listen(options = {}) {
6970
const {prefetchChunks} = options;
7071

7172
const prefetchHandler = urls => {
72-
prefetch(urls, options.priority).then(isDone).catch(error => {
73-
isDone();
74-
if (options.onError) options.onError(error);
75-
});
73+
prefetch(urls, options.priority)
74+
.then(isDone)
75+
.catch(error => {
76+
isDone();
77+
if (options.onError) options.onError(error);
78+
});
7679
};
7780

7881
const observer = new IntersectionObserver(entries => {
@@ -82,7 +85,9 @@ export function listen(options = {}) {
8285
// Do not prefetch if will match/exceed limit
8386
if (toPrefetch.size < limit) {
8487
toAdd(() => {
85-
prefetchChunks ? prefetchChunks(entry, prefetchHandler) : prefetchHandler(entry.href);
88+
prefetchChunks ?
89+
prefetchChunks(entry, prefetchHandler) :
90+
prefetchHandler(entry.href);
8691
});
8792
}
8893
}
@@ -112,11 +117,11 @@ export function listen(options = {}) {
112117
}
113118

114119
/**
115-
* Prefetch a given URL with an optional preferred fetch priority
116-
* @param {String} url - the URL to fetch
117-
* @param {Boolean} [isPriority] - if is "high" priority
118-
* @return {Object} a Promise
119-
*/
120+
* Prefetch a given URL with an optional preferred fetch priority
121+
* @param {String} url - the URL to fetch
122+
* @param {Boolean} [isPriority] - if is "high" priority
123+
* @return {Object} a Promise
124+
*/
120125
export function prefetch(url, isPriority) {
121126
const {connection} = navigator;
122127

‎src/index.mjs

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
15-
**/
15+
**/
16+
1617
import throttle from 'throttles';
1718
import {priority, supported} from './prefetch.mjs';
1819
import requestIdleCallback from './request-idle-callback.mjs';

‎src/prefetch.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1616
* See the License for the specific language governing permissions and
1717
* limitations under the License.
18-
**/
18+
**/
1919

2020
/**
2121
* Checks if a feature on `link` is natively supported.

‎src/prerender.mjs

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1616
* See the License for the specific language governing permissions and
1717
* limitations under the License.
18-
**/
18+
**/
19+
1920
/**
2021
* Checks if the given string is a same origin url
2122
* @param {string} str - the URL to check

‎src/react-chunks.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/**
22
* Copyright 2019-2020 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,7 +12,7 @@
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
15-
*/
15+
**/
1616

1717
import React, {useEffect, useRef, useState} from 'react';
1818
import rmanifest from 'route-manifest';

‎src/request-idle-callback.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
15-
**/
15+
**/
1616

1717
// RIC and shim for browsers setTimeout() without it
1818
const requestIdleCallback = window.requestIdleCallback ||

‎translations/zh-cn/README.md

+20-20
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,17 @@ npm install --save quicklink
5050
<script src="dist/quicklink.js"></script>
5151
<!-- 初始化(你可以随时进行) -->
5252
<script>
53-
quicklink();
53+
quicklink();
5454
</script>
5555
```
5656

5757
举个例子,你可以在 `load` 方法触发之后进行初始化:
5858

5959
```html
6060
<script>
61-
window.addEventListener('load', () =>{
62-
quicklink();
63-
});
61+
window.addEventListener('load', () => {
62+
quicklink();
63+
});
6464
</script>
6565
```
6666

@@ -115,7 +115,7 @@ quicklink();
115115

116116
```js
117117
quicklink({
118-
timeout: 4000
118+
timeout: 4000,
119119
});
120120
```
121121

@@ -126,7 +126,7 @@ quicklink({
126126
```js
127127
const elem = document.getElementById('carousel');
128128
quicklink({
129-
el: elem
129+
el: elem,
130130
});
131131
```
132132

@@ -136,7 +136,7 @@ quicklink({
136136

137137
```js
138138
quicklink({
139-
urls: ['2.html','3.html', '4.js']
139+
urls: ['2.html', '3.html', '4.js'],
140140
});
141141
```
142142

@@ -164,7 +164,7 @@ quicklink({
164164
'other-website.com',
165165
'example.com',
166166
// ...
167-
]
167+
],
168168
});
169169
```
170170

@@ -178,7 +178,7 @@ quicklink({
178178
quicklink({
179179
origins: true,
180180
// 或者
181-
origins: []
181+
origins: [],
182182
});
183183
```
184184

@@ -198,8 +198,8 @@ quicklink({
198198
ignores: [
199199
/\/api\/?/,
200200
uri => uri.includes('.zip'),
201-
(uri, elem) => elem.hasAttribute('noprefetch')
202-
]
201+
(uri, elem) => elem.hasAttribute('noprefetch'),
202+
],
203203
});
204204
```
205205

@@ -209,11 +209,11 @@ quicklink({
209209

210210
```js
211211
quicklink({
212-
ignores: [
213-
uri => uri.includes('#')
214-
// 或者使用正则表达式: /#(.+)/
215-
// 或者使用元素匹配: (uri, elem) => !!elem.hash
216-
]
212+
ignores: [
213+
uri => uri.includes('#'),
214+
// 或者使用正则表达式: /#(.+)/
215+
// 或者使用元素匹配: (uri, elem) => !!elem.hash
216+
],
217217
});
218218
```
219219

@@ -236,11 +236,11 @@ quicklink 提供的预获取是[渐进增强](https://www.smashingmagazine.com/2
236236

237237
```html
238238
<script type="module">
239-
import prefetch from '../src/prefetch.mjs';
239+
import prefetch from '../src/prefetch.mjs';
240240
241-
const urls = ['1.html', '2.html'];
242-
const promises = urls.map(url => prefetch(url));
243-
Promise.all(promises);
241+
const urls = ['1.html', '2.html'];
242+
const promises = urls.map(url => prefetch(url));
243+
Promise.all(promises);
244244
</script>
245245
```
246246

0 commit comments

Comments
 (0)
Please sign in to comment.