-
Notifications
You must be signed in to change notification settings - Fork 5
feat: Add markdown lint #212
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
Open
saraed-zenika
wants to merge
15
commits into
main
Choose a base branch
from
add_markdown_lint
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
e82af96
feat: Add markdown lint
saraed-zenika a45eae6
feat: Lint must not rewrite files
saraed-zenika 17e7334
feat: Fix lint errors
saraed-zenika bbc6fbd
feat: add TU function containsAnyError
saraed-zenika 231628f
feat: change the textlint command
saraed-zenika 4a321ed
feat: Fix message lint
saraed-zenika 73a8589
feat: fix issue prettier
saraed-zenika 874e78f
feat : add
saraed-zenika db828ba
feat: fix quality code
saraed-zenika 51e08f3
feat: fix lint rules and add tests (PR)
saraed-zenika ff24985
feat: fix issue (PR)
saraed-zenika fd95b25
Adjust output format
gmembre-zenika 295d3a5
add exclude files
gmembre-zenika ceb8bf2
os
gmembre-zenika 982573e
lint
gmembre-zenika File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| const titleOrCommentLinePattern = /^\s*((##)|(<!-- \.slide: class="page-).*)$/; | ||
| const nPreviousEmpty = 3; | ||
|
|
||
| function allEmpty(lines) { | ||
| return lines.every((l) => l.trim() === ""); | ||
| } | ||
|
|
||
| export async function checkLines(readStream) { | ||
| // Buffer circulaire pour stocker les nPreviousEmpty lignes précédentes | ||
| const prevLines = []; | ||
| var index = 1; | ||
| var containsError = false; | ||
|
|
||
| for await (const line of readStream) { | ||
| // Vérifie si la ligne courante match le pattern | ||
| if (titleOrCommentLinePattern.test(line)) { | ||
| if (!allEmpty(prevLines)) { | ||
| console.info( | ||
| `Il faut minimum ${nPreviousEmpty} lignes vides devant le bloc "${line}" ligne n°${index}.` | ||
| ); | ||
| containsError = true; | ||
| } | ||
| } | ||
|
|
||
| // Increment du nombre de ligne | ||
| index += 1; | ||
|
|
||
| // Ajoute la ligne actuelle dans le buffer, limite la taille à nPreviousEmpty | ||
| prevLines.push(line); | ||
| if (prevLines.length > nPreviousEmpty) { | ||
| prevLines.shift(); // enlève la plus vieille ligne | ||
| } | ||
| } | ||
|
|
||
| return containsError; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.