diff --git a/.gitignore b/.gitignore index 0c93016..ba85f45 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ node_modules/ *.log .DS_Store yarn.lock +!/index.d.ts diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..aa5af5c --- /dev/null +++ b/index.d.ts @@ -0,0 +1,32 @@ +/* eslint-disable @typescript-eslint/ban-types, @typescript-eslint/consistent-type-definitions */ + +export {default} from './lib/index.js' + +/** + * Configuration. + */ +export interface Options { + /** + * Check relative values relative to this URL + * (optional, example: `'https://example.com/from'`). + */ + from?: string | null | undefined + /** + * Whether to ignore `localhost` links such as `http://localhost/*`, + * `http://127.0.0.1/*` + * (default: `false`). + */ + skipLocalhost?: boolean | null | undefined + /** + * Whether to let offline runs pass quietly + * (default: `false`). + */ + skipOffline?: boolean | null | undefined + /** + * List of patterns for URLs that should be skipped + * (optional); + * each URL will be tested against each pattern and will be ignored if + * `new RegExp(pattern).test(url) === true`. + */ + skipUrlPatterns?: ReadonlyArray | null | undefined +} diff --git a/lib/index.js b/lib/index.js index be7dc35..c738875 100644 --- a/lib/index.js +++ b/lib/index.js @@ -2,25 +2,13 @@ * @typedef {import('mdast').Nodes} Nodes * @typedef {import('mdast').Resource} Resource * @typedef {import('mdast').Root} Root + * + * @typedef {import('remark-lint-no-dead-urls').Options} Options + * * @typedef {import('vfile').VFile} VFile */ /** - * @typedef Options - * Configuration. - * @property {string | null | undefined} [from] - * Check relative values relative to this URL (optiona, example: - * `'https://example.com/from'`). - * @property {boolean | null | undefined} [skipLocalhost=false] - * Whether to ignore `localhost` links such as `http://localhost/*`, - * `http://127.0.0.1/*` (default: `false`). - * @property {boolean | null | undefined} [skipOffline=false] - * Whether to let offline runs pass quietly (default: `false`). - * @property {Array | null | undefined} [skipUrlPatterns] - * List of patterns for URLs that should be skipped (optional); - * each URL will be tested against each pattern and will be ignored if - * `new RegExp(pattern).test(url) === true`. - * * @typedef {Extract} Resources * Resource nodes. */ diff --git a/tsconfig.json b/tsconfig.json index a3163d7..a31d13e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,5 +12,5 @@ "target": "es2020" }, "exclude": ["coverage/", "node_modules/"], - "include": ["**/*.js"] + "include": ["**/*.js", "index.d.ts"] }