mirror of
https://github.com/theoludwig/markdownlint-rule-relative-links.git
synced 2024-12-08 00:45:32 +01:00
chore: initial commit
This commit is contained in:
commit
221ded7d62
1
.commitlintrc.json
Normal file
1
.commitlintrc.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{ "extends": ["@commitlint/config-conventional"] }
|
11
.editorconfig
Normal file
11
.editorconfig
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# For more information see: https://editorconfig.org/
|
||||||
|
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
7
.eslintrc.json
Normal file
7
.eslintrc.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"extends": ["conventions", "prettier"],
|
||||||
|
"plugins": ["prettier"],
|
||||||
|
"rules": {
|
||||||
|
"prettier/prettier": "error"
|
||||||
|
}
|
||||||
|
}
|
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
* text=auto eol=lf
|
20
.github/ISSUE_TEMPLATE/BUG.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/BUG.md
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: '🐛 Bug Report'
|
||||||
|
about: 'Report an unexpected problem or unintended behavior.'
|
||||||
|
title: '[Bug]'
|
||||||
|
labels: 'bug'
|
||||||
|
---
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Please provide a clear and concise description of what the bug is. Include
|
||||||
|
screenshots if needed. Please make sure your issue has not already been fixed.
|
||||||
|
-->
|
||||||
|
|
||||||
|
## Steps To Reproduce
|
||||||
|
|
||||||
|
1. Step 1
|
||||||
|
2. Step 2
|
||||||
|
|
||||||
|
## The current behavior
|
||||||
|
|
||||||
|
## The expected behavior
|
18
.github/ISSUE_TEMPLATE/DOCUMENTATION.md
vendored
Normal file
18
.github/ISSUE_TEMPLATE/DOCUMENTATION.md
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
name: '📜 Documentation'
|
||||||
|
about: 'Correct spelling errors, improvements or additions to documentation files (README, CONTRIBUTING...).'
|
||||||
|
title: '[Documentation]'
|
||||||
|
labels: 'documentation'
|
||||||
|
---
|
||||||
|
|
||||||
|
<!-- Please make sure your issue has not already been fixed. -->
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
<!-- Please uncomment the type of documentation problem this issue address -->
|
||||||
|
|
||||||
|
<!-- Documentation is Missing -->
|
||||||
|
<!-- Documentation is Confusing -->
|
||||||
|
<!-- Documentation has Typo errors -->
|
||||||
|
|
||||||
|
## Proposal
|
20
.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: '✨ Feature Request'
|
||||||
|
about: 'Suggest a new feature idea.'
|
||||||
|
title: '[Feature]'
|
||||||
|
labels: 'feature request'
|
||||||
|
---
|
||||||
|
|
||||||
|
<!-- Please make sure your issue has not already been fixed. -->
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
<!-- A clear and concise description of the problem or missing capability... -->
|
||||||
|
|
||||||
|
## Describe the solution you'd like
|
||||||
|
|
||||||
|
<!-- If you have a solution in mind, please describe it. -->
|
||||||
|
|
||||||
|
## Describe alternatives you've considered
|
||||||
|
|
||||||
|
<!-- Have you considered any alternative solutions or workarounds? -->
|
20
.github/ISSUE_TEMPLATE/IMPROVEMENT.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/IMPROVEMENT.md
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: '🔧 Improvement'
|
||||||
|
about: 'Improve structure/format/performance/refactor/tests of the code.'
|
||||||
|
title: '[Improvement]'
|
||||||
|
labels: 'improvement'
|
||||||
|
---
|
||||||
|
|
||||||
|
<!-- Please make sure your issue has not already been fixed. -->
|
||||||
|
|
||||||
|
## Type of Improvement
|
||||||
|
|
||||||
|
<!-- Please uncomment the type of improvements this issue address -->
|
||||||
|
|
||||||
|
<!-- Files and Folders Structure -->
|
||||||
|
<!-- Performance -->
|
||||||
|
<!-- Refactoring code -->
|
||||||
|
<!-- Tests -->
|
||||||
|
<!-- Not Sure? -->
|
||||||
|
|
||||||
|
## Proposal
|
8
.github/ISSUE_TEMPLATE/QUESTION.md
vendored
Normal file
8
.github/ISSUE_TEMPLATE/QUESTION.md
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
name: '🙋 Question'
|
||||||
|
about: 'Further information is requested.'
|
||||||
|
title: '[Question]'
|
||||||
|
labels: 'question'
|
||||||
|
---
|
||||||
|
|
||||||
|
### Question
|
7
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
7
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<!-- Please first discuss the change you wish to make via issue before making a change. It might avoid a waste of your time. -->
|
||||||
|
|
||||||
|
## What changes this PR introduce?
|
||||||
|
|
||||||
|
## List any relevant issue numbers
|
||||||
|
|
||||||
|
## Is there anything you'd like reviewers to focus on?
|
28
.github/workflows/lint.yml
vendored
Normal file
28
.github/workflows/lint.yml
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
name: 'Lint'
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [develop]
|
||||||
|
pull_request:
|
||||||
|
branches: [master, develop]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: 'ubuntu-latest'
|
||||||
|
steps:
|
||||||
|
- uses: 'actions/checkout@v3.0.0'
|
||||||
|
|
||||||
|
- name: 'Use Node.js'
|
||||||
|
uses: 'actions/setup-node@v3.1.0'
|
||||||
|
with:
|
||||||
|
node-version: 'lts/*'
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: 'Install'
|
||||||
|
run: 'npm install'
|
||||||
|
|
||||||
|
- run: 'npm run lint:commit -- --to "${{ github.sha }}"'
|
||||||
|
- run: 'npm run lint:editorconfig'
|
||||||
|
- run: 'npm run lint:markdown'
|
||||||
|
- run: 'npm run lint:eslint'
|
||||||
|
- run: 'npm run lint:prettier'
|
29
.github/workflows/release.yml
vendored
Normal file
29
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
name: 'Release'
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: 'ubuntu-latest'
|
||||||
|
steps:
|
||||||
|
- uses: 'actions/checkout@v3.0.0'
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: 'Use Node.js'
|
||||||
|
uses: 'actions/setup-node@v3.1.0'
|
||||||
|
with:
|
||||||
|
node-version: 'lts/*'
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: 'Install'
|
||||||
|
run: 'npm install'
|
||||||
|
|
||||||
|
- name: 'Release'
|
||||||
|
run: 'npm run release'
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
25
.github/workflows/test.yml
vendored
Normal file
25
.github/workflows/test.yml
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
name: 'Test'
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [develop]
|
||||||
|
pull_request:
|
||||||
|
branches: [master, develop]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: 'ubuntu-latest'
|
||||||
|
steps:
|
||||||
|
- uses: 'actions/checkout@v3.0.0'
|
||||||
|
|
||||||
|
- name: 'Use Node.js'
|
||||||
|
uses: 'actions/setup-node@v3.1.0'
|
||||||
|
with:
|
||||||
|
node-version: 'lts/*'
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: 'Install'
|
||||||
|
run: 'npm install'
|
||||||
|
|
||||||
|
- name: 'Test'
|
||||||
|
run: 'npm run test'
|
29
.gitignore
vendored
Normal file
29
.gitignore
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# dependencies
|
||||||
|
node_modules
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# testing
|
||||||
|
coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# debug
|
||||||
|
npm-debug.log*
|
||||||
|
|
||||||
|
# IDEs and editors
|
||||||
|
/.idea
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
.c9/
|
||||||
|
*.launch
|
||||||
|
.settings/
|
||||||
|
*.sublime-workspace
|
||||||
|
|
||||||
|
# IDE - VSCode
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
|
||||||
|
# misc
|
||||||
|
.DS_Store
|
4
.husky/commit-msg
Executable file
4
.husky/commit-msg
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
. "$(dirname "$0")/_/husky.sh"
|
||||||
|
|
||||||
|
npm run lint:commit -- --edit
|
5
.husky/pre-commit
Executable file
5
.husky/pre-commit
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
. "$(dirname "$0")/_/husky.sh"
|
||||||
|
|
||||||
|
npm run lint:staged
|
||||||
|
npm run test
|
6
.lintstagedrc.json
Normal file
6
.lintstagedrc.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"*": ["editorconfig-checker"],
|
||||||
|
"*.{js,jsx,ts,tsx}": ["prettier --write", "eslint --fix"],
|
||||||
|
"*.{json,jsonc,yml,yaml}": ["prettier --write"],
|
||||||
|
"*.{md,mdx}": ["prettier --write", "markdownlint-cli2 --fix"]
|
||||||
|
}
|
5
.markdownlint-cli2.jsonc
Normal file
5
.markdownlint-cli2.jsonc
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"globs": ["**/*.{md,mdx}"],
|
||||||
|
"ignores": ["**/node_modules", "**/test/fixtures"],
|
||||||
|
"customRules": ["./src/index.js"]
|
||||||
|
}
|
8
.markdownlint.json
Normal file
8
.markdownlint.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"default": true,
|
||||||
|
"relative-links": true,
|
||||||
|
"extends": "markdownlint/style/prettier",
|
||||||
|
"MD024": false,
|
||||||
|
"MD033": false,
|
||||||
|
"MD041": false
|
||||||
|
}
|
6
.prettierrc.json
Normal file
6
.prettierrc.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"singleQuote": true,
|
||||||
|
"jsxSingleQuote": true,
|
||||||
|
"semi": false,
|
||||||
|
"trailingComma": "none"
|
||||||
|
}
|
19
.releaserc.json
Normal file
19
.releaserc.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"branches": ["master"],
|
||||||
|
"plugins": [
|
||||||
|
[
|
||||||
|
"@semantic-release/commit-analyzer",
|
||||||
|
{
|
||||||
|
"preset": "conventionalcommits"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"@semantic-release/release-notes-generator",
|
||||||
|
{
|
||||||
|
"preset": "conventionalcommits"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@semantic-release/npm",
|
||||||
|
"@semantic-release/github"
|
||||||
|
]
|
||||||
|
}
|
8
.taprc
Normal file
8
.taprc
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
ts: false
|
||||||
|
jsx: false
|
||||||
|
flow: false
|
||||||
|
check-coverage: false
|
||||||
|
coverage: false
|
||||||
|
|
||||||
|
files:
|
||||||
|
- 'test/**/*.test.js'
|
8
.vscode/extensions.json
vendored
Normal file
8
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"recommendations": [
|
||||||
|
"editorconfig.editorconfig",
|
||||||
|
"esbenp.prettier-vscode",
|
||||||
|
"dbaeumer.vscode-eslint",
|
||||||
|
"davidanson.vscode-markdownlint"
|
||||||
|
]
|
||||||
|
}
|
8
.vscode/settings.json
vendored
Normal file
8
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||||
|
"prettier.configPath": ".prettierrc.json",
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"editor.codeActionsOnSave": {
|
||||||
|
"source.fixAll": true
|
||||||
|
}
|
||||||
|
}
|
132
CODE_OF_CONDUCT.md
Normal file
132
CODE_OF_CONDUCT.md
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
# Contributor Covenant Code of Conduct
|
||||||
|
|
||||||
|
## Our Pledge
|
||||||
|
|
||||||
|
We as members, contributors, and leaders pledge to make participation in our
|
||||||
|
community a harassment-free experience for everyone, regardless of age, body
|
||||||
|
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||||
|
identity and expression, level of experience, education, socio-economic status,
|
||||||
|
nationality, personal appearance, race, religion, or sexual identity
|
||||||
|
and orientation.
|
||||||
|
|
||||||
|
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||||
|
diverse, inclusive, and healthy community.
|
||||||
|
|
||||||
|
## Our Standards
|
||||||
|
|
||||||
|
Examples of behavior that contributes to a positive environment for our
|
||||||
|
community include:
|
||||||
|
|
||||||
|
- Demonstrating empathy and kindness toward other people
|
||||||
|
- Being respectful of differing opinions, viewpoints, and experiences
|
||||||
|
- Giving and gracefully accepting constructive feedback
|
||||||
|
- Accepting responsibility and apologizing to those affected by our mistakes,
|
||||||
|
and learning from the experience
|
||||||
|
- Focusing on what is best not just for us as individuals, but for the
|
||||||
|
overall community
|
||||||
|
|
||||||
|
Examples of unacceptable behavior include:
|
||||||
|
|
||||||
|
- The use of sexualized language or imagery, and sexual attention or
|
||||||
|
advances of any kind
|
||||||
|
- Trolling, insulting or derogatory comments, and personal or political attacks
|
||||||
|
- Public or private harassment
|
||||||
|
- Publishing others' private information, such as a physical or email
|
||||||
|
address, without their explicit permission
|
||||||
|
- Other conduct which could reasonably be considered inappropriate in a
|
||||||
|
professional setting
|
||||||
|
|
||||||
|
## Enforcement Responsibilities
|
||||||
|
|
||||||
|
Community leaders are responsible for clarifying and enforcing our standards of
|
||||||
|
acceptable behavior and will take appropriate and fair corrective action in
|
||||||
|
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||||
|
or harmful.
|
||||||
|
|
||||||
|
Community leaders have the right and responsibility to remove, edit, or reject
|
||||||
|
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||||
|
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||||
|
decisions when appropriate.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
This Code of Conduct applies within all community spaces, and also applies when
|
||||||
|
an individual is officially representing the community in public spaces.
|
||||||
|
Examples of representing our community include using an official e-mail address,
|
||||||
|
posting via an official social media account, or acting as an appointed
|
||||||
|
representative at an online or offline event.
|
||||||
|
|
||||||
|
## Enforcement
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
|
reported to the community leaders responsible for enforcement at
|
||||||
|
contact@divlo.fr.
|
||||||
|
All complaints will be reviewed and investigated promptly and fairly.
|
||||||
|
|
||||||
|
All community leaders are obligated to respect the privacy and security of the
|
||||||
|
reporter of any incident.
|
||||||
|
|
||||||
|
## Enforcement Guidelines
|
||||||
|
|
||||||
|
Community leaders will follow these Community Impact Guidelines in determining
|
||||||
|
the consequences for any action they deem in violation of this Code of Conduct:
|
||||||
|
|
||||||
|
### 1. Correction
|
||||||
|
|
||||||
|
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||||
|
unprofessional or unwelcome in the community.
|
||||||
|
|
||||||
|
**Consequence**: A private, written warning from community leaders, providing
|
||||||
|
clarity around the nature of the violation and an explanation of why the
|
||||||
|
behavior was inappropriate. A public apology may be requested.
|
||||||
|
|
||||||
|
### 2. Warning
|
||||||
|
|
||||||
|
**Community Impact**: A violation through a single incident or series
|
||||||
|
of actions.
|
||||||
|
|
||||||
|
**Consequence**: A warning with consequences for continued behavior. No
|
||||||
|
interaction with the people involved, including unsolicited interaction with
|
||||||
|
those enforcing the Code of Conduct, for a specified period of time. This
|
||||||
|
includes avoiding interactions in community spaces as well as external channels
|
||||||
|
like social media. Violating these terms may lead to a temporary or
|
||||||
|
permanent ban.
|
||||||
|
|
||||||
|
### 3. Temporary Ban
|
||||||
|
|
||||||
|
**Community Impact**: A serious violation of community standards, including
|
||||||
|
sustained inappropriate behavior.
|
||||||
|
|
||||||
|
**Consequence**: A temporary ban from any sort of interaction or public
|
||||||
|
communication with the community for a specified period of time. No public or
|
||||||
|
private interaction with the people involved, including unsolicited interaction
|
||||||
|
with those enforcing the Code of Conduct, is allowed during this period.
|
||||||
|
Violating these terms may lead to a permanent ban.
|
||||||
|
|
||||||
|
### 4. Permanent Ban
|
||||||
|
|
||||||
|
**Community Impact**: Demonstrating a pattern of violation of community
|
||||||
|
standards, including sustained inappropriate behavior, harassment of an
|
||||||
|
individual, or aggression toward or disparagement of classes of individuals.
|
||||||
|
|
||||||
|
**Consequence**: A permanent ban from any sort of public interaction within
|
||||||
|
the community.
|
||||||
|
|
||||||
|
## Attribution
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||||
|
version 2.0, available at
|
||||||
|
[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
|
||||||
|
|
||||||
|
Community Impact Guidelines were inspired by
|
||||||
|
[Mozilla's code of conduct enforcement ladder][mozilla coc].
|
||||||
|
|
||||||
|
For answers to common questions about this code of conduct, see the FAQ at
|
||||||
|
[https://www.contributor-covenant.org/faq][faq]. Translations are available
|
||||||
|
at [https://www.contributor-covenant.org/translations][translations].
|
||||||
|
|
||||||
|
[homepage]: https://www.contributor-covenant.org
|
||||||
|
[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
|
||||||
|
[mozilla coc]: https://github.com/mozilla/diversity
|
||||||
|
[faq]: https://www.contributor-covenant.org/faq
|
||||||
|
[translations]: https://www.contributor-covenant.org/translations
|
46
CONTRIBUTING.md
Normal file
46
CONTRIBUTING.md
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
# 💡 Contributing
|
||||||
|
|
||||||
|
Thanks a lot for your interest in contributing to **markdownlint-rule-relative-links**! 🎉
|
||||||
|
|
||||||
|
## Types of contributions
|
||||||
|
|
||||||
|
- Reporting a bug.
|
||||||
|
- Suggest a new feature idea.
|
||||||
|
- Correct spelling errors, improvements or additions to documentation files (README, CONTRIBUTING...).
|
||||||
|
- Improve structure/format/performance/refactor/tests of the code.
|
||||||
|
|
||||||
|
## Pull Requests
|
||||||
|
|
||||||
|
- **Please first discuss** the change you wish to make via [issue](https://github.com/Divlo/markdownlint-rule-relative-links/issues) before making a change. It might avoid a waste of your time.
|
||||||
|
|
||||||
|
- Ensure your code respect linting.
|
||||||
|
|
||||||
|
- Make sure your **code passes the tests**.
|
||||||
|
|
||||||
|
If you're adding new features to **markdownlint-rule-relative-links**, please include tests.
|
||||||
|
|
||||||
|
## Commits
|
||||||
|
|
||||||
|
The commit message guidelines respect [@commitlint/config-conventional](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional) and [Semantic Versioning](https://semver.org/) for releases.
|
||||||
|
|
||||||
|
### Types
|
||||||
|
|
||||||
|
Types define which kind of changes you made to the project.
|
||||||
|
|
||||||
|
| Types | Description |
|
||||||
|
| -------- | ------------------------------------------------------------------------------------------------------------ |
|
||||||
|
| feat | A new feature. |
|
||||||
|
| fix | A bug fix. |
|
||||||
|
| docs | Documentation only changes. |
|
||||||
|
| style | Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc). |
|
||||||
|
| refactor | A code change that neither fixes a bug nor adds a feature. |
|
||||||
|
| perf | A code change that improves performance. |
|
||||||
|
| test | Adding missing tests or correcting existing tests. |
|
||||||
|
| build | Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm). |
|
||||||
|
| ci | Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs). |
|
||||||
|
| chore | Other changes that don't modify src or test files. |
|
||||||
|
| revert | Reverts a previous commit. |
|
||||||
|
|
||||||
|
### Scopes
|
||||||
|
|
||||||
|
Scopes define what part of the code changed.
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Divlo
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
88
README.md
Normal file
88
README.md
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
<h1 align="center">markdownlint-rule-relative-links</h1>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<strong>Custom rule for <a href="https://github.com/DavidAnson/markdownlint">markdownlint</a> to validate relative links.</strong>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="./CONTRIBUTING.md"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat" /></a>
|
||||||
|
<a href="./LICENSE"><img src="https://img.shields.io/badge/licence-MIT-blue.svg" alt="Licence MIT"/></a>
|
||||||
|
<a href="./CODE_OF_CONDUCT.md"><img src="https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg" alt="Contributor Covenant" /></a>
|
||||||
|
<br />
|
||||||
|
<a href="https://github.com/Divlo/markdownlint-rule-relative-links/actions/workflows/lint.yml"><img src="https://github.com/Divlo/markdownlint-rule-relative-links/actions/workflows/lint.yml/badge.svg?branch=develop" /></a>
|
||||||
|
<a href="https://github.com/Divlo/emarkdownlint-rule-relative-linksactions/workflows/test.yml"><img src="https://github.com/Divlo/markdownlint-rule-relative-links/actions/workflows/test.yml/badge.svg?branch=develop" /></a>
|
||||||
|
<br />
|
||||||
|
<a href="https://conventionalcommits.org"><img src="https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg" alt="Conventional Commits" /></a>
|
||||||
|
<a href="https://github.com/semantic-release/semantic-release"><img src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg" alt="semantic-release" /></a>
|
||||||
|
<a href="https://www.npmjs.com/package/markdownlint-rule-relative-links"><img src="https://img.shields.io/npm/v/markdownlint-rule-relative-links.svg" alt="npm version"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## 📜 About
|
||||||
|
|
||||||
|
**markdownlint-rule-relative-links** is a [markdownlint](https://github.com/DavidAnson/markdownlint) custom rule to validate relative links.
|
||||||
|
|
||||||
|
It ensures that relative links that start with `./` or `../` (or not starting with external protocols like `http://` or `https://`) are working and not "dead" which means that it exists in the file system of the project that uses `markdownlint`.
|
||||||
|
|
||||||
|
Related links:
|
||||||
|
|
||||||
|
- [DavidAnson/markdownlint#253](https://github.com/DavidAnson/markdownlint/issues/253)
|
||||||
|
- [DavidAnson/markdownlint#121](https://github.com/DavidAnson/markdownlint/issues/121)
|
||||||
|
- [nschonni/markdownlint-valid-links](https://github.com/nschonni/markdownlint-valid-links)
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- [Node.js](https://nodejs.org/) >= 16.0.0
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install --save-dev markdownlint-rule-relative-links
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
There are various ways `markdownlint` can be configured using objects, config files etc. For more information on `markdownlint` configuration refer [options.config](https://github.com/DavidAnson/markdownlint#optionsconfig).
|
||||||
|
|
||||||
|
We recommend configuring `markdownlint-cli2` over `markdownlint-cli` for compatibility with the `vscode-markdownlint` plugin.
|
||||||
|
|
||||||
|
`.markdownlint-cli2.jsonc`
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"config": {
|
||||||
|
"default": true,
|
||||||
|
"relative-links": true
|
||||||
|
},
|
||||||
|
"globs": ["**/*.{md,mdx}"],
|
||||||
|
"ignores": ["**/node_modules"],
|
||||||
|
"customRules": ["markdownlint-rule-relative-links"]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
`package.json`
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"scripts": {
|
||||||
|
"lint:markdown": "markdownlint-cli2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm run lint:markdown
|
||||||
|
```
|
||||||
|
|
||||||
|
## 💡 Contributing
|
||||||
|
|
||||||
|
Anyone can help to improve the project, submit a Feature Request, a bug report or even correct a simple spelling mistake.
|
||||||
|
|
||||||
|
The steps to contribute can be found in the [CONTRIBUTING.md](./CONTRIBUTING.md) file.
|
||||||
|
|
||||||
|
## 📄 License
|
||||||
|
|
||||||
|
[MIT](./LICENSE)
|
22157
package-lock.json
generated
Normal file
22157
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
62
package.json
Normal file
62
package.json
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
{
|
||||||
|
"name": "markdownlint-rule-relative-links",
|
||||||
|
"version": "0.0.0-development",
|
||||||
|
"public": true,
|
||||||
|
"description": "Custom rule for markdownlint to validate relative links.",
|
||||||
|
"author": "Divlo <contact@divlo.fr>",
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/Divlo/markdownlint-rule-relative-links.git"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/Divlo/markdownlint-rule-relative-links/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/Divlo/markdownlint-rule-relative-links#readme",
|
||||||
|
"keywords": [
|
||||||
|
"markdownlint",
|
||||||
|
"markdownlint-rule"
|
||||||
|
],
|
||||||
|
"main": "src/index.js",
|
||||||
|
"files": [
|
||||||
|
"src"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=16.0.0",
|
||||||
|
"npm": ">=8.0.0"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"lint:commit": "commitlint",
|
||||||
|
"lint:editorconfig": "editorconfig-checker",
|
||||||
|
"lint:markdown": "markdownlint-cli2",
|
||||||
|
"lint:eslint": "eslint \"**/*.{js,jsx,ts,tsx}\" --ignore-path \".gitignore\"",
|
||||||
|
"lint:prettier": "prettier \".\" --check --ignore-path \".gitignore\"",
|
||||||
|
"lint:staged": "lint-staged",
|
||||||
|
"test": "tap",
|
||||||
|
"release": "semantic-release",
|
||||||
|
"postinstall": "husky install",
|
||||||
|
"prepublishOnly": "pinst --disable",
|
||||||
|
"postpublish": "pinst --enable"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@commitlint/cli": "17.3.0",
|
||||||
|
"@commitlint/config-conventional": "17.3.0",
|
||||||
|
"@types/tap": "15.0.7",
|
||||||
|
"editorconfig-checker": "4.0.2",
|
||||||
|
"eslint": "8.31.0",
|
||||||
|
"eslint-config-conventions": "6.0.0",
|
||||||
|
"eslint-config-prettier": "8.5.0",
|
||||||
|
"eslint-plugin-import": "2.26.0",
|
||||||
|
"eslint-plugin-prettier": "4.2.1",
|
||||||
|
"eslint-plugin-promise": "6.1.1",
|
||||||
|
"eslint-plugin-unicorn": "45.0.2",
|
||||||
|
"husky": "8.0.2",
|
||||||
|
"lint-staged": "13.1.0",
|
||||||
|
"markdownlint": "0.27.0",
|
||||||
|
"markdownlint-cli2": "0.6.0",
|
||||||
|
"pinst": "3.0.0",
|
||||||
|
"prettier": "2.8.1",
|
||||||
|
"semantic-release": "19.0.5",
|
||||||
|
"tap": "16.3.2"
|
||||||
|
}
|
||||||
|
}
|
10
src/index.js
Normal file
10
src/index.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
'use strict'
|
||||||
|
|
||||||
|
const customRule = {
|
||||||
|
names: ['relative-links'],
|
||||||
|
description: 'Relative links should be valid',
|
||||||
|
tags: ['links'],
|
||||||
|
function: () => {}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = customRule
|
24
test/basic.test.js
Normal file
24
test/basic.test.js
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
const tap = require('tap')
|
||||||
|
const { markdownlint } = require('markdownlint').promises
|
||||||
|
|
||||||
|
const relativeLinks = require('../src/index.js')
|
||||||
|
|
||||||
|
tap.test('ensure we validate correctly', async (t) => {
|
||||||
|
const lintResults = await markdownlint({
|
||||||
|
files: ['test/fixtures/Valid.md', 'test/fixtures/Invalid.md'],
|
||||||
|
config: {
|
||||||
|
'relative-links': true
|
||||||
|
},
|
||||||
|
customRules: [relativeLinks]
|
||||||
|
})
|
||||||
|
t.equal(lintResults['test/fixtures/Valid.md'].length, 0)
|
||||||
|
t.equal(lintResults['test/fixtures/Invalid.md'].length, 1)
|
||||||
|
t.equal(
|
||||||
|
lintResults['test/fixtures/Invalid.md'][0].ruleDescription,
|
||||||
|
'Relative links should be valid'
|
||||||
|
)
|
||||||
|
t.equal(
|
||||||
|
lintResults['test/fixtures/Invalid.md'][0].errorDetail,
|
||||||
|
'Link "./basic.test.js" is dead'
|
||||||
|
)
|
||||||
|
})
|
3
test/fixtures/Invalid.md
vendored
Normal file
3
test/fixtures/Invalid.md
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Invalid
|
||||||
|
|
||||||
|
[basic.js](./basic.test.js)
|
3
test/fixtures/Valid.md
vendored
Normal file
3
test/fixtures/Valid.md
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Valid
|
||||||
|
|
||||||
|
[basic.js](../basic.test.js)
|
Loading…
Reference in New Issue
Block a user