-
-
Notifications
You must be signed in to change notification settings - Fork 159
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
[jsdoc/require-returns] Allow specific contexts to have forceRequireReturn
#757
Labels
Comments
We already have a kind of pattern established for context objects, so I think that might be the route to go: {
"json/require-returns": [
"error",
{
"contexts": [
"FunctionDeclaration",
{context: "TSEmptyBodyFunctionExpression", forceRequireReturns: true}
]
}
]
} This approach would also have the benefits of being more immediately readable and allowing expansion to any other context-specific config. |
brettz9
added a commit
to brettz9/eslint-plugin-jsdoc
that referenced
this issue
May 29, 2023
brettz9
added a commit
to brettz9/eslint-plugin-jsdoc
that referenced
this issue
May 30, 2023
brettz9
added a commit
to brettz9/eslint-plugin-jsdoc
that referenced
this issue
May 30, 2023
brettz9
added a commit
that referenced
this issue
May 31, 2023
🎉 This issue has been resolved in version 46.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
crapStone
pushed a commit
to Calciumdibromid/CaBr2
that referenced
this issue
Jun 6, 2023
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) | devDependencies | major | [`40.3.0` -> `46.2.4`](https://renovatebot.com/diffs/npm/eslint-plugin-jsdoc/40.3.0/46.2.4) | --- ### Release Notes <details> <summary>gajus/eslint-plugin-jsdoc</summary> ### [`v46.2.4`](https://github.com/gajus/eslint-plugin-jsdoc/releases/tag/v46.2.4) [Compare Source](gajus/eslint-plugin-jsdoc@v46.2.3...v46.2.4) ##### Bug Fixes - **`imports-as-dependencies`:** allow relative paths ([7469e59](gajus/eslint-plugin-jsdoc@7469e59)) ### [`v46.2.3`](https://github.com/gajus/eslint-plugin-jsdoc/releases/tag/v46.2.3) [Compare Source](gajus/eslint-plugin-jsdoc@v46.2.2...v46.2.3) ##### Bug Fixes - **`imports-as-dependencies`:** catch `typings` as possible publishing source ([e3b0d0c](gajus/eslint-plugin-jsdoc@e3b0d0c)) ### [`v46.2.2`](https://github.com/gajus/eslint-plugin-jsdoc/releases/tag/v46.2.2) [Compare Source](gajus/eslint-plugin-jsdoc@v46.2.1...v46.2.2) ##### Bug Fixes - **`imports-as-dependencies`:** don't report TypeScript proper ([75b6b8c](gajus/eslint-plugin-jsdoc@75b6b8c)) ### [`v46.2.1`](https://github.com/gajus/eslint-plugin-jsdoc/releases/tag/v46.2.1) [Compare Source](gajus/eslint-plugin-jsdoc@v46.2.0...v46.2.1) ##### Bug Fixes - **`imports-as-dependencies`:** check for `types` in `package.json` and if not present, check `[@types](https://github.com/types)`; fixes [#​1107](gajus/eslint-plugin-jsdoc#1107) ([785fb26](gajus/eslint-plugin-jsdoc@785fb26)) ### [`v46.2.0`](https://github.com/gajus/eslint-plugin-jsdoc/releases/tag/v46.2.0) [Compare Source](gajus/eslint-plugin-jsdoc@v46.1.0...v46.2.0) ##### Features - **`imports-as-dependencies`:** add new rule to detect missing dependencies for import statements; fixes [#​896](gajus/eslint-plugin-jsdoc#896) ([d7ec6e0](gajus/eslint-plugin-jsdoc@d7ec6e0)) ### [`v46.1.0`](https://github.com/gajus/eslint-plugin-jsdoc/releases/tag/v46.1.0) [Compare Source](gajus/eslint-plugin-jsdoc@v46.0.0...v46.1.0) ##### Features - **`require-returns`:** per-context `forceRequireReturn`; fixes [#​757](gajus/eslint-plugin-jsdoc#757) ([31b3a24](gajus/eslint-plugin-jsdoc@31b3a24)) ### [`v46.0.0`](https://github.com/gajus/eslint-plugin-jsdoc/releases/tag/v46.0.0) [Compare Source](gajus/eslint-plugin-jsdoc@v45.0.0...v46.0.0) ##### Features - **`no-defaults`:** make no-defaults on by default ([034ade1](gajus/eslint-plugin-jsdoc@034ade1)) ##### BREAKING CHANGES - **`no-defaults`:** Removes default values. Disable the rule if removal not desired. Also: - docs: adds info on TS recommended rules ### [`v45.0.0`](https://github.com/gajus/eslint-plugin-jsdoc/releases/tag/v45.0.0) [Compare Source](gajus/eslint-plugin-jsdoc@v44.2.7...v45.0.0) ##### Features - add recommended-typescript-flavor configs ([6042b77](gajus/eslint-plugin-jsdoc@6042b77)) - for typescript configs, disable `no-undefined-types`; fixes [#​888](gajus/eslint-plugin-jsdoc#888) ([ec41b90](gajus/eslint-plugin-jsdoc@ec41b90)) ##### BREAKING CHANGES - This should only impact users of typescript configs. TS should itself handle checking for undefined types, so the (imperfect) rule has been disabled for such users. ### [`v44.2.7`](gajus/eslint-plugin-jsdoc@v44.2.6...v44.2.7) [Compare Source](gajus/eslint-plugin-jsdoc@v44.2.6...v44.2.7) ### [`v44.2.6`](gajus/eslint-plugin-jsdoc@v44.2.5...v44.2.6) [Compare Source](gajus/eslint-plugin-jsdoc@v44.2.5...v44.2.6) ### [`v44.2.5`](gajus/eslint-plugin-jsdoc@v44.2.4...v44.2.5) [Compare Source](gajus/eslint-plugin-jsdoc@v44.2.4...v44.2.5) ### [`v44.2.4`](gajus/eslint-plugin-jsdoc@v44.2.3...v44.2.4) [Compare Source](gajus/eslint-plugin-jsdoc@v44.2.3...v44.2.4) ### [`v44.2.3`](gajus/eslint-plugin-jsdoc@v44.2.2...v44.2.3) [Compare Source](gajus/eslint-plugin-jsdoc@v44.2.2...v44.2.3) ### [`v44.2.2`](gajus/eslint-plugin-jsdoc@v44.2.1...v44.2.2) [Compare Source](gajus/eslint-plugin-jsdoc@v44.2.1...v44.2.2) ### [`v44.2.1`](gajus/eslint-plugin-jsdoc@v44.2.0...v44.2.1) [Compare Source](gajus/eslint-plugin-jsdoc@v44.2.0...v44.2.1) ### [`v44.2.0`](gajus/eslint-plugin-jsdoc@v44.1.0...v44.2.0) [Compare Source](gajus/eslint-plugin-jsdoc@v44.1.0...v44.2.0) ### [`v44.1.0`](gajus/eslint-plugin-jsdoc@v44.0.2...v44.1.0) [Compare Source](gajus/eslint-plugin-jsdoc@v44.0.2...v44.1.0) ### [`v44.0.2`](gajus/eslint-plugin-jsdoc@v44.0.1...v44.0.2) [Compare Source](gajus/eslint-plugin-jsdoc@v44.0.1...v44.0.2) ### [`v44.0.1`](gajus/eslint-plugin-jsdoc@v44.0.0...v44.0.1) [Compare Source](gajus/eslint-plugin-jsdoc@v44.0.0...v44.0.1) ### [`v44.0.0`](gajus/eslint-plugin-jsdoc@v43.2.0...v44.0.0) [Compare Source](gajus/eslint-plugin-jsdoc@v43.2.0...v44.0.0) ### [`v43.2.0`](gajus/eslint-plugin-jsdoc@v43.1.1...v43.2.0) [Compare Source](gajus/eslint-plugin-jsdoc@v43.1.1...v43.2.0) ### [`v43.1.1`](gajus/eslint-plugin-jsdoc@v43.1.0...v43.1.1) [Compare Source](gajus/eslint-plugin-jsdoc@v43.1.0...v43.1.1) ### [`v43.1.0`](gajus/eslint-plugin-jsdoc@v43.0.9...v43.1.0) [Compare Source](gajus/eslint-plugin-jsdoc@v43.0.9...v43.1.0) ### [`v43.0.9`](gajus/eslint-plugin-jsdoc@v43.0.8...v43.0.9) [Compare Source](gajus/eslint-plugin-jsdoc@v43.0.8...v43.0.9) ### [`v43.0.8`](gajus/eslint-plugin-jsdoc@v43.0.7...v43.0.8) [Compare Source](gajus/eslint-plugin-jsdoc@v43.0.7...v43.0.8) ### [`v43.0.7`](gajus/eslint-plugin-jsdoc@v43.0.6...v43.0.7) [Compare Source](gajus/eslint-plugin-jsdoc@v43.0.6...v43.0.7) ### [`v43.0.6`](gajus/eslint-plugin-jsdoc@v43.0.5...v43.0.6) [Compare Source](gajus/eslint-plugin-jsdoc@v43.0.5...v43.0.6) ### [`v43.0.5`](gajus/eslint-plugin-jsdoc@v43.0.4...v43.0.5) [Compare Source](gajus/eslint-plugin-jsdoc@v43.0.4...v43.0.5) ### [`v43.0.4`](gajus/eslint-plugin-jsdoc@v43.0.3...v43.0.4) [Compare Source](gajus/eslint-plugin-jsdoc@v43.0.3...v43.0.4) ### [`v43.0.3`](gajus/eslint-plugin-jsdoc@v43.0.2...v43.0.3) [Compare Source](gajus/eslint-plugin-jsdoc@v43.0.2...v43.0.3) ### [`v43.0.2`](gajus/eslint-plugin-jsdoc@v43.0.1...v43.0.2) [Compare Source](gajus/eslint-plugin-jsdoc@v43.0.1...v43.0.2) ### [`v43.0.1`](gajus/eslint-plugin-jsdoc@v43.0.0...v43.0.1) [Compare Source](gajus/eslint-plugin-jsdoc@v43.0.0...v43.0.1) ### [`v43.0.0`](gajus/eslint-plugin-jsdoc@v42.0.0...v43.0.0) [Compare Source](gajus/eslint-plugin-jsdoc@v42.0.0...v43.0.0) ### [`v42.0.0`](gajus/eslint-plugin-jsdoc@v41.1.2...v42.0.0) [Compare Source](gajus/eslint-plugin-jsdoc@v41.1.2...v42.0.0) ### [`v41.1.2`](gajus/eslint-plugin-jsdoc@v41.1.1...v41.1.2) [Compare Source](gajus/eslint-plugin-jsdoc@v41.1.1...v41.1.2) ### [`v41.1.1`](gajus/eslint-plugin-jsdoc@v41.1.0...v41.1.1) [Compare Source](gajus/eslint-plugin-jsdoc@v41.1.0...v41.1.1) ### [`v41.1.0`](gajus/eslint-plugin-jsdoc@v41.0.0...v41.1.0) [Compare Source](gajus/eslint-plugin-jsdoc@v41.0.0...v41.1.0) ### [`v41.0.0`](gajus/eslint-plugin-jsdoc@v40.3.0...v41.0.0) [Compare Source](gajus/eslint-plugin-jsdoc@v40.3.0...v41.0.0) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xMTEuMCIsInVwZGF0ZWRJblZlciI6IjM1LjExMS4wIiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCJ9--> Co-authored-by: cabr2-bot <cabr2.help@gmail.com> Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1913 Reviewed-by: Epsilon_02 <epsilon_02@noreply.codeberg.org> Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org> Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Motivation
Especially when writing code in TypeScript, there are certain use-cases (when writing abstract methods or interfaces) where you don't have a method- or function-body and therefore want to have
forceRequireReturn
turned on.However, you mostly don't want to have
forceRequireReturn
turned on for all contexts as you might not want to have it turned on for functions withoutreturn
s in it.Current behavior
forceRequireReturn
can only be set to aboolean
allowing the user to forcereturn
s for all contexts or not requiring it at all.Desired behavior
I'd like to be able to provide a
string
-array asforceRequireReturn
-option for specifying the contexts which are required to have a@returns
-tag:Alternatives considered
Allow passing a
boolean
-array containing a value indicating whether a@returns
-tag is enforced for the corresponding context:Or allow passing a context and a, optionally, a
boolean
indicating whether the specified context forces@returns
-tags:Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: