-
Notifications
You must be signed in to change notification settings - Fork 59
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
Adds a YAML eslint linter. #312
Conversation
Changes AnalysisCommit SHA: ae4c918 API ChangesSummaryNO CHANGES ReportThe full API changes report is available at: https://github.com/opensearch-project/opensearch-api-specification/actions/runs/9416605489/artifacts/1578965962 API Coverage
|
tools/tests/linter/fixtures/folder_validators/namespaces/invalid_folder/dup_path_b.yaml
Outdated
Show resolved
Hide resolved
eslint.config.mjs
Outdated
@@ -51,7 +68,22 @@ export default [ | |||
'array-callback-return': 'off', | |||
'new-cap': 'off', | |||
'no-return-assign': 'error', | |||
'object-shorthand': 'error' | |||
'object-shorthand': 'error', | |||
'no-constant-condition': 'off' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're turning off a lot of TS lints in this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually we're not, these are added via recommended-type-checked
and I believe we didn't have them enabled before.
$ git diff
diff --git a/eslint.config.mjs b/eslint.config.mjs
index 53e6a18..acb7a4b 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -52,6 +52,13 @@ export default [
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false
}
],
+ '@typescript-eslint/no-explicit-any': 'error',
+ '@typescript-eslint/no-unsafe-assignment': 'error',
+ '@typescript-eslint/no-unsafe-return': 'error',
+ '@typescript-eslint/no-unsafe-call': 'error',
+ '@typescript-eslint/no-unsafe-member-access': 'error',
+ '@typescript-eslint/no-unused-vars': ['error', { "argsIgnorePattern": "^_" }],
+ '@typescript-eslint/require-await': 'error',
'array-callback-return': 'off',
'new-cap': 'off',
'no-return-assign': 'error',
$ npm run lint
✖ 193 problems (193 errors, 0 warnings)
3 errors and 0 warnings potentially fixable with the `--fix` option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two of these are easy to enable. The others give hundreds of errors.
- opensearch-api-specification#318: Turn on @typescript-eslint/no-unused-var.
- opensearch-api-specification#319: Turn on @typescript-eslint/require-await.
8784e29
to
92d0ca2
Compare
This is ready. I only auto-fixed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Need a rebase.
Rebased. |
Signed-off-by: dblock <dblock@amazon.com>
Signed-off-by: dblock <dblock@amazon.com>
…e linter. Signed-off-by: dblock <dblock@amazon.com>
Signed-off-by: dblock <dblock@amazon.com>
Signed-off-by: dblock <dblock@amazon.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #312 +/- ##
=======================================
Coverage ? 88.74%
=======================================
Files ? 40
Lines ? 1164
Branches ? 283
=======================================
Hits ? 1033
Misses ? 123
Partials ? 8 ☔ View full report in Codecov by Sentry. |
Signed-off-by: dblock <dblock@amazon.com>
Description
Lints YAML using a formatting linter. Fixes things like spaces, preferring single/double quotes, etc.
We have a spec linter that is about the spec itself in which we could implement some of these rules too, but feels easier. That one probably could have been (still can be) a generic eslint linter, too.
Issues Resolved
Closes #266.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.