Skip to content

Commit

Permalink
Refactor code-style
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Apr 10, 2024
1 parent 56b572a commit 426f596
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 61 deletions.
36 changes: 18 additions & 18 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,48 @@

## 2.0.0

* Migrate package to [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c)
* Add [TypeScript](https://www.typescriptlang.org/) typings
* Support `remark` version 14
* Migrate package to [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c)
* Add [TypeScript](https://www.typescriptlang.org/) typings
* Support `remark` version 14

## 1.1.0

* Add `skipUrlPatterns` option.
* Add `skipUrlPatterns` option.

## 1.0.2

* Walk the AST fewer times.
* Walk the AST fewer times.

## 1.0.1

* Bump patch versions of dependencies.
* Bump patch versions of dependencies.

## 1.0.0

* Add `skipLocalhost` option.
* Add `skipLocalhost` option.

## 0.5.0

* Drop Node 6 support.
* Update dependencies to remove deprecation notice about `OutgoingMessage.prototype._headers`.
* Drop Node 6 support.
* Update dependencies to remove deprecation notice about `OutgoingMessage.prototype._headers`.

## 0.4.1

* Bump check-links dependency.
* Bump check-links dependency.

## 0.4.0

* Use [check-links](https://github.com/transitive-bullshit/check-links).
* Replace `baseUrl` option with `gotOptions.baseUrl`.
* Remove `cache` option.
check-links does not expose similar cache configuration.
* Drop Node 4 support.
* Use [check-links](https://github.com/transitive-bullshit/check-links).
* Replace `baseUrl` option with `gotOptions.baseUrl`.
* Remove `cache` option.
check-links does not expose similar cache configuration.
* Drop Node 4 support.

## 0.3.0

* Skip URLs with protocols other than `http:` and `https:`.
* Handle offline smoothly and add `skipOffline` option.
* Skip URLs with protocols other than `http:` and `https:`.
* Handle offline smoothly and add `skipOffline` option.

## 0.2.0

* Start this log.
* Start this log.
12 changes: 2 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,8 @@
},
"remarkConfig": {
"plugins": [
"remark-preset-wooorm",
[
"remark-preset-wooorm/node_modules/remark-gfm/index.js",
false
],
"remark-gfm"
],
"settings": {
"listItemIndent": "tab"
}
"remark-preset-wooorm"
]
},
"typeCoverage": {
"atLeast": 100,
Expand Down
72 changes: 39 additions & 33 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ Uses [check-links][] to check URLs for liveness.

A few details to keep in mind:

* By default, relative URLs are skipped.
To check relative URLs, set `gotOptions.baseUrl` (see below).
* Ignores absolute URLs with protocols other than `http:` and `https:`.
* [check-links][] memoizes results, so on any given run each URL will only be
pinged once; subsequent checks will be returned from the cache.
* By default, relative URLs are skipped.
To check relative URLs, set `gotOptions.baseUrl` (see below).
* Ignores absolute URLs with protocols other than `http:` and `https:`.
* [check-links][] memoizes results, so on any given run each URL will only be
pinged once; subsequent checks will be returned from the cache.

## Usage

Expand All @@ -40,34 +40,40 @@ Check out the [remark-lint][] documentation for details.
All options are optional.
The options object may contain any of the following properties:

* **skipOffline** `{boolean}` - Default: `false`.
By default, if you are offline when you run the check you will receive a
warning.
If you want to let offline runs quietly pass, set this option to `true`.
* **skipLocalhost** `{boolean}` - Default: `false`.
By default, `localhost` links are treated the same as other links, so if
your project is not running locally you’ll receive a warning.
If you want to ignore `localhost` links (e.g. `http://localhost/*`,
`http://127.0.0.1/*`), set this option to `true`.
* **skipUrlPatterns** `{Array}` - Array of `String` | `RegExp`.
A list of patterns for URLs that should be skipped.
Each URL will be tested against each pattern, and will be ignored if `new RegExp(pattern).test(url) === true`.
For example, with `skipUrlPatterns: [/^http:\/\/(.*)url-to-ignore\.com/, 'https://never-check.com']`,
links with the URLs `http://www.url-to-ignore.com/foo` and `https://never-check.com/foo/bar`
will not be checked.
* **gotOptions** `{Object}` - Passed through [check-links][] to [Got][].
See documentation for [Got options](https://github.com/sindresorhus/got#options).
With these options, you can customize retry logic, specify custom headers,
and more.
Here are some specific Got options that you might want to use:
* **gotOptions.prefixUrl** `{string}` - Used as the base URL against
which relative URLs are checked.
By default, relative URLs are ignored: you must provide this option to
check them.
For example, with `prefixUrl: 'https://www.github.com'`, the relative
URL `/davidtheclark` is checked as `https://www.github.com/davidtheclark`.
* **gotOptions.concurrency** `{number}` - Maximum number of URLs to check
concurrently (default `8`).
* **skipOffline** `{boolean}` - Default: `false`.
By default, if you are offline when you run the check you will receive a
warning.
If you want to let offline runs quietly pass, set this option to `true`.
* **skipLocalhost** `{boolean}` - Default: `false`.
By default, `localhost` links are treated the same as other links, so if
your project is not running locally you’ll receive a warning.
If you want to ignore `localhost` links (e.g. `http://localhost/*`,
`http://127.0.0.1/*`), set this option to `true`.
* **skipUrlPatterns** `{Array}` - Array of `String` | `RegExp`.
A list of patterns for URLs that should be skipped.
Each URL will be tested against each pattern, and will be ignored if
`new RegExp(pattern).test(url) === true`.
For example, with
`skipUrlPatterns: [/^http:\/\/(.*)url-to-ignore\.com/,
'https://never-check.com']`,
links with the URLs `http://www.url-to-ignore.com/foo`
and
`https://never-check.com/foo/bar`
will not be checked.
* **gotOptions** `{Object}` - Passed through [check-links][] to [Got][].
See documentation for
[Got options](https://github.com/sindresorhus/got#options).
With these options, you can customize retry logic, specify custom headers,
and more.
Here are some specific Got options that you might want to use:
* **gotOptions.prefixUrl** `{string}` - Used as the base URL against
which relative URLs are checked.
By default, relative URLs are ignored: you must provide this option to
check them.
For example, with `prefixUrl: 'https://www.github.com'`, the relative
URL `/davidtheclark` is checked as `https://www.github.com/davidtheclark`.
* **gotOptions.concurrency** `{number}` - Maximum number of URLs to check
concurrently (default `8`).

## Example

Expand Down

0 comments on commit 426f596

Please sign in to comment.