-
Notifications
You must be signed in to change notification settings - Fork 38
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
[PSC-2029] Add lint rule to prevent trailing forward slashes #2154
Conversation
In an attempt to increase consistency across endpoints, Airtasker wants to avoid having endpoints whose path ends with a trailing forward slash. This PR adds a lint rule that rejects contracts containing endpoints with a trailing forward slash. To maintain backwards compatibility, the default `LintConfig` has been updated to only `warn` on such issues. The rule can be enforced by running `spot lint <api.rs> --no-trailing-forward-slash=error` The rule can be fully disabled by running `spot lint <api.ts> --no-trailing-forward-slash=off`.
@@ -12,7 +12,8 @@ export interface LintConfig { | |||
|
|||
const lintConfig: LintConfig = { | |||
rules: { | |||
"no-omittable-fields-within-response-bodies": "warn" | |||
"no-omittable-fields-within-response-bodies": "warn", | |||
"no-trailing-forward-slash": "warn" |
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.
This is the default configuration used by the lint
command. It can be overriden via command-line arguments since #2153
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.
LGTM 👍
Nice one.
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.
LGTM 💯
Description, Motivation and Context
In an attempt to increase consistency across endpoints, Airtasker wants to avoid having endpoints whose path ends with a trailing forward slash. This PR adds a lint rule that rejects contracts containing endpoints with a trailing forward slash.
To maintain backwards compatibility, the default
LintConfig
has been updated to onlywarn
on such issues.The rule can be enforced by running
spot lint <api.rs> --no-trailing-forward-slash=error
The rule can be fully disabled by running
spot lint <api.ts> --no-trailing-forward-slash=off
.Example output:
Checklist: