Skip to content

Minor Markdown and lint tweaks #370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .babelrc.js
Original file line number Diff line number Diff line change
@@ -7,8 +7,8 @@ module.exports = {
'@babel/preset-env',
{
loose: true,
bugfixes: true
}
]
]
bugfixes: true,
},
],
],
};
8 changes: 4 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -57,13 +57,13 @@ module.exports = {
},
overrides: [
{
'files': [
files: [
'site/**',
],
'parserOptions': {
'sourceType': 'script',
parserOptions: {
sourceType: 'script',
},
'rules': {
rules: {
'require-jsdoc': 'off',
},
},
10 changes: 8 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -5,20 +5,26 @@ labels:
---

**Before you start**

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:

**Describe the bug**

A clear and concise description of what the bug is.

**To Reproduce**

Steps to reproduce the behavior.

**Expected behavior**

A clear and concise description of what you expected to happen.

**Version:**
- OS w/ version: [e.g. iOS 12]
- Browser w/ version [e.g. Chrome 75]

* OS w/ version: [e.g. iOS 12]
* Browser w/ version [e.g. Chrome 75]

**Additional context, screenshots, screencasts**

Add any other context about the problem here.
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@
* [site] reorder logos ([09907bb](https://github.com/GoogleChromeLabs/quicklink/commit/09907bb))
* [site] update version ([7babbda](https://github.com/GoogleChromeLabs/quicklink/commit/7babbda))
* Add Magento Quicklink module (Readme + Site) (#216) ([c77e057](https://github.com/GoogleChromeLabs/quicklink/commit/c77e057)), closes [#216](https://github.com/GoogleChromeLabs/quicklink/issues/216)
* 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)
* 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)
* Instructions to debug Quicklink ([2b3dc21](https://github.com/GoogleChromeLabs/quicklink/commit/2b3dc21))

## 2.1.0 (2021-02-07)
@@ -74,7 +74,7 @@
* 2.0.0-beta ([185d1e8](https://github.com/GoogleChromeLabs/quicklink/commit/185d1e8))
* Add support for Quicklink 2.0.0-alpha ([7c7c917](https://github.com/GoogleChromeLabs/quicklink/commit/7c7c917))
* Add twitter metadata ([74d3224](https://github.com/GoogleChromeLabs/quicklink/commit/74d3224))
* Adding SPA section to README.md ([ea3229a](https://github.com/GoogleChromeLabs/quicklink/commit/ea3229a))
* Adding SPA section to README.md ([ea3229a](https://github.com/GoogleChromeLabs/quicklink/commit/ea3229a))
* Fix typo on README (#127) ([5acb27e](https://github.com/GoogleChromeLabs/quicklink/commit/5acb27e)), closes [#127](https://github.com/GoogleChromeLabs/quicklink/issues/127)
* package.json: bump version to 2.0.0-alpha ([d5d5ca5](https://github.com/GoogleChromeLabs/quicklink/commit/d5d5ca5))
* 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 @@
* Mention instant.page as a related project ([0bc8aec](https://github.com/GoogleChromeLabs/quicklink/commit/0bc8aec))
* 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)
* 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)
* 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)
* 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)
* 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)
* 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)
* 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)
* Update microbundle to fix "missing JSX plugin" issue ([8f5cf22](https://github.com/GoogleChromeLabs/quicklink/commit/8f5cf22))
* Update repo path in package.json ([45e9bbd](https://github.com/GoogleChromeLabs/quicklink/commit/45e9bbd))
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ Here's an example of how to debug the library by using one of these tests:

```js
<script type="module">
import { listen } from '../../src/index.mjs';
import {listen} from '../../src/index.mjs';
listen();
</script>
```
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -69,7 +69,7 @@ For example, you can initialize after the `load` event fires:
ES Module import:

```js
import { listen, prefetch } from 'quicklink';
import {listen, prefetch} from 'quicklink';
```

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

```jsx
import { withQuicklink } from 'quicklink/dist/react/hoc.js';
import {withQuicklink} from 'quicklink/dist/react/hoc.js';

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

```html
<script type="module">
import { prefetch } from 'quicklink';
import {prefetch} from 'quicklink';
prefetch(['1.html', '2.html']).catch(err => {
// Handle own errors
});
6 changes: 4 additions & 2 deletions demos/news-workbox/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@

# Demo: Quicklink usage with workbox

A demo showing how to use Quicklink with Workbox for offline caching and links in the visible viewport.

## Glitch Source

* [Link to Glitch App](https://anton-karlovskiy-quicklink-news-workbox.glitch.me)
* [Link to Project on Glitch](https://glitch.com/~anton-karlovskiy-quicklink-news-workbox)

## Installation
```

```sh
git clone https://api.glitch.com/git/anton-karlovskiy-quicklink-news-workbox
npm install
npm start
6 changes: 4 additions & 2 deletions demos/news/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@

# Demo: Quicklink basic usage

A demo showing how to use Quicklink on a simple multi-page website.

## Glitch Source

* [Link to Glitch App](https://anton-karlovskiy-quicklink-news.glitch.me)
* [Link to Project on Glitch](https://glitch.com/~anton-karlovskiy-quicklink-news)

## Installation
```

```sh
git clone https://api.glitch.com/git/anton-karlovskiy-quicklink-news
npm install
npm start
7 changes: 5 additions & 2 deletions demos/spa/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# Demo: Quicklink integration for create-react-app

A demo showing how to use Quicklink with in a create-react-app site.
To integrate your React SPA with Quicklink, follow the steps [here](https://github.com/GoogleChromeLabs/quicklink#single-page-apps-react).

## Glitch Source

* [Link to Glitch App](https://create-react-app-quicklink.glitch.me/)
* [Link to Project on Glitch](https://glitch.com/~create-react-app-quicklink)

## Installation
```

```sh
git clone https://api.glitch.com/git/create-react-app-quicklink
npm install
npm start
npm run build
```
```
18 changes: 9 additions & 9 deletions site/.config/configstore/update-notifier-pnpm.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"optOut": false,
"lastUpdateCheck": 1574808403652,
"update": {
"latest": "4.3.3",
"current": "2.25.5",
"type": "major",
"name": "pnpm"
}
}
"optOut": false,
"lastUpdateCheck": 1574808403652,
"update": {
"latest": "4.3.3",
"current": "2.25.5",
"type": "major",
"name": "pnpm"
}
}
2 changes: 1 addition & 1 deletion site/firebase.json
Original file line number Diff line number Diff line change
@@ -64,4 +64,4 @@
}
]
}
}
}
2 changes: 1 addition & 1 deletion site/src/script.js
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ window.addEventListener('load', () => {

window.addEventListener('scroll', trackScroll, {passive: true});
goTopBtn.addEventListener('click', backToTop);
};
}

initGoToTopBtn();

27 changes: 16 additions & 11 deletions src/chunks.mjs
Original file line number Diff line number Diff line change
@@ -12,7 +12,8 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
**/

import throttle from 'throttles';
import {priority, supported} from './prefetch.mjs';
import requestIdleCallback from './request-idle-callback.mjs';
@@ -69,10 +70,12 @@ export function listen(options = {}) {
const {prefetchChunks} = options;

const prefetchHandler = urls => {
prefetch(urls, options.priority).then(isDone).catch(error => {
isDone();
if (options.onError) options.onError(error);
});
prefetch(urls, options.priority)
.then(isDone)
.catch(error => {
isDone();
if (options.onError) options.onError(error);
});
};

const observer = new IntersectionObserver(entries => {
@@ -82,7 +85,9 @@ export function listen(options = {}) {
// Do not prefetch if will match/exceed limit
if (toPrefetch.size < limit) {
toAdd(() => {
prefetchChunks ? prefetchChunks(entry, prefetchHandler) : prefetchHandler(entry.href);
prefetchChunks ?
prefetchChunks(entry, prefetchHandler) :
prefetchHandler(entry.href);
});
}
}
@@ -112,11 +117,11 @@ export function listen(options = {}) {
}

/**
* Prefetch a given URL with an optional preferred fetch priority
* @param {String} url - the URL to fetch
* @param {Boolean} [isPriority] - if is "high" priority
* @return {Object} a Promise
*/
* Prefetch a given URL with an optional preferred fetch priority
* @param {String} url - the URL to fetch
* @param {Boolean} [isPriority] - if is "high" priority
* @return {Object} a Promise
*/
export function prefetch(url, isPriority) {
const {connection} = navigator;

3 changes: 2 additions & 1 deletion src/index.mjs
Original file line number Diff line number Diff line change
@@ -12,7 +12,8 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
**/

import throttle from 'throttles';
import {priority, supported} from './prefetch.mjs';
import requestIdleCallback from './request-idle-callback.mjs';
2 changes: 1 addition & 1 deletion src/prefetch.mjs
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
**/

/**
* Checks if a feature on `link` is natively supported.
3 changes: 2 additions & 1 deletion src/prerender.mjs
Original file line number Diff line number Diff line change
@@ -15,7 +15,8 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
**/

/**
* Checks if the given string is a same origin url
* @param {string} str - the URL to check
4 changes: 2 additions & 2 deletions src/react-chunks.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/**
* Copyright 2019-2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,7 +12,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
**/

import React, {useEffect, useRef, useState} from 'react';
import rmanifest from 'route-manifest';
2 changes: 1 addition & 1 deletion src/request-idle-callback.mjs
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
**/

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