-
Notifications
You must be signed in to change notification settings - Fork 24
feat: create linter system #191
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
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
63e0d97
feat: linter
flakey5 0036260
feat: wip
araujogui 4aa4f77
fix: optional location
araujogui 5e1c0ec
fix: create hasError getter
araujogui b396444
fix: optional location
araujogui b443a7a
test: update expected metadata
araujogui 5248f11
refactor: some changes
araujogui 7dfb6dc
fix: missing reporter option
araujogui 762adeb
fix: reporter node position
araujogui b7e8597
refactor: some improvements
araujogui 95f67ab
refactor: better docs
araujogui d7394b7
refactor: remove useless directive
araujogui 622e6a3
refactor: remove semver regex
araujogui a2dae43
refactor: add yaml_position description
araujogui 3e912e7
test: create rules tests
araujogui 7e9a3f4
test: create reporters tests
araujogui bcebcdd
fix: missing change version issue location
araujogui 881ce3c
feat: add disable rule cli option
araujogui 5aeccfe
test: create engine test
araujogui bf4d935
feat: create cli option
araujogui fab1c6a
test: oops
araujogui b1fa0a1
chore: add FORCE_COLOR env
araujogui 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 |
|---|---|---|
|
|
@@ -9,6 +9,9 @@ on: | |
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| FORCE_COLOR: 1 | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
|
|
||
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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,51 @@ | ||
| 'use strict'; | ||
|
|
||
| /** | ||
| * Creates a linter engine instance to validate ApiDocMetadataEntry entries | ||
| * | ||
| * @param {import('./types').LintRule} rules Lint rules to validate the entries against | ||
| */ | ||
| const createLinterEngine = rules => { | ||
| /** | ||
| * Validates a ApiDocMetadataEntry entry against all defined rules | ||
| * | ||
| * @param {ApiDocMetadataEntry} entry | ||
| * @returns {import('./types').LintIssue[]} | ||
| */ | ||
| const lint = entry => { | ||
| const issues = []; | ||
|
|
||
| for (const rule of rules) { | ||
| const ruleIssues = rule(entry); | ||
|
|
||
| if (ruleIssues.length > 0) { | ||
| issues.push(...ruleIssues); | ||
| } | ||
| } | ||
|
|
||
| return issues; | ||
| }; | ||
|
|
||
| /** | ||
| * Validates an array of ApiDocMetadataEntry entries against all defined rules | ||
| * | ||
| * @param {ApiDocMetadataEntry[]} entries | ||
| * @returns {import('./types').LintIssue[]} | ||
| */ | ||
| const lintAll = entries => { | ||
| const issues = []; | ||
|
|
||
| for (const entry of entries) { | ||
| issues.push(...lint(entry)); | ||
| } | ||
|
|
||
| return issues; | ||
| }; | ||
|
|
||
| return { | ||
| lint, | ||
| lintAll, | ||
| }; | ||
| }; | ||
|
|
||
| export default createLinterEngine; |
Oops, something went wrong.
Oops, something went wrong.
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.