Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(eslint-plugin): [explicit-function-return-type] add allowedNames#4440

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@islandryu
Copy link
Contributor

@islandryuislandryu commentedJan 14, 2022
edited by bradzacher
Loading

Add optionallowedNames to explicit-function-return-type

PR Checklist

Overview

You may pass function/method names you would like this rule to ignore, like so:

{"@typescript-eslint/explicit-function-return-type": ["error",    {"allowedNames": ["ignoredFunctionName","ignoredMethodName"]    }  ]}

@nx-cloud
Copy link

nx-cloudbot commentedJan 14, 2022
edited
Loading

☁️ Nx Cloud Report

CI ran the following commands for commit65103ff. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 48 targets

Sent with 💌 fromNxCloud.

@typescript-eslint
Copy link
Contributor

Thanks for the PR,@islandryu!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently onhttps://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitorsper day.

@netlify
Copy link

netlifybot commentedJan 14, 2022
edited
Loading

❌ Deploy Preview fortypescript-eslint failed.

🔨 Explore the source changes:65103ff

🔍 Inspect the deploy log:https://app.netlify.com/sites/typescript-eslint/deploys/61f8ee03e1dd9e00086c7f6a

@codecov
Copy link

codecovbot commentedJan 14, 2022
edited
Loading

Codecov Report

Merging#4440 (65103ff) intomain (04baac8) willincrease coverage by0.01%.
The diff coverage is100.00%.

@@            Coverage Diff             @@##             main    #4440      +/-   ##==========================================+ Coverage   94.54%   94.56%   +0.01%==========================================  Files         147      147                Lines        7851     7877      +26       Branches     2516     2530      +14     ==========================================+ Hits         7423     7449      +26  Misses        234      234                Partials      194      194
FlagCoverage Δ
unittest94.56% <100.00%> (+0.01%)⬆️

Flags with carried forward coverage won't be shown.Click here to find out more.

Impacted FilesCoverage Δ
...-plugin/src/rules/explicit-function-return-type.ts100.00% <100.00%> (ø)

@islandryuislandryu marked this pull request as ready for reviewJanuary 14, 2022 14:43
@bradzacherbradzacher added the enhancement: plugin rule optionNew rule option for an existing eslint-plugin rule labelJan 14, 2022
Copy link
Member

@JoshuaKGoldbergJoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM in general, thanks!

Codecov is right that there's a gap in test coverage; could you please
add a bit more testing and resolve the conflicts from themain branch? Once you do I think we should be good to merge.

@JoshuaKGoldbergJoshuaKGoldberg added the awaiting responseIssues waiting for a reply from the OP or another party labelJan 23, 2022
islandryuand others added9 commitsJanuary 24, 2022 11:59
Co-authored-by: Josh Goldberg <me@joshuakgoldberg.com>
…dNames to work for object properties and class methods
…dNames to work for object properties and class methods
@islandryu
Copy link
ContributorAuthor

@JoshuaKGoldberg
Thank you for review!
I resolved conflict and improved coverage.

I apologize for the large number of commits.

@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commentedJan 29, 2022
edited
Loading

Large number of commits is no problem 😄, I do that all the time. We squash PR merges anyway and most PRs -including this one- are a small enough number of changes that we don't particularly need a Git walkthrough. Thanks!

JoshuaKGoldberg
JoshuaKGoldberg previously approved these changesJan 29, 2022
Copy link
Member

@JoshuaKGoldbergJoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Super, thanks so much@islandryu! 🚀

@JoshuaKGoldbergJoshuaKGoldbergenabled auto-merge (squash)January 29, 2022 15:28
@islandryu
Copy link
ContributorAuthor

@JoshuaKGoldberg
Sorry, I updated the PR by mistake.
Is there anything left for me to do regarding this PR?

@JoshuaKGoldberg
Copy link
Member

Nope, it's ready to merge!

I don't have the ability to merge on a failing build and the Netlify deployment is nondeterministically failing. cc@bradzacher

@bradzacher
Copy link
Member

@JoshuaKGoldberg - I've removed netlify from the "required" list of checks, so you should be able to merge past that signal from now on!

JoshuaKGoldberg and islandryu reacted with heart emoji

Copy link
Member

@bradzacherbradzacher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

just one small comment about correctness - otherwise great work!

caseAST_NODE_TYPES.MethodDefinition:
caseAST_NODE_TYPES.PropertyDefinition:
caseAST_NODE_TYPES.Property:{
if(parent.key.type===AST_NODE_TYPES.Identifier){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

one minor problem with this code:

constignoredName='notIgnoredName';classFoo{[ignoredName](){}}

This is valid code! Which obviously shouldnot be ignored.
Only checking for.key.type === 'Identifier' will match this case.
You should also assert that.computed === false.

cc@JoshuaKGoldberg as an FYI - this is a really common case that everyone (including me!) always forgets for properties of all kinds AND for member expressions as well.
I raised the issue with the estree spec but the outcome there was really "spec can't change".

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Ah thanks for the spot!

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thank you!
I didn't know such a pattern existed.
@bradzacher
I changed the computed name so that it is not ignored by the allowedName.

Copy link
Member

@bradzacherbradzacher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

nice one! LGTM

@bradzacherbradzacher merged commit936e252 intotypescript-eslint:mainFeb 2, 2022
@islandryuislandryu deleted the featAddallowedNames branchFebruary 9, 2022 13:25
lonyele pushed a commit to lonyele/typescript-eslint that referenced this pull requestFeb 12, 2022
…typescript-eslint#4440)* feat(eslint-plugin): [explicit-function-return-type] add allowedNames option* feat(eslint-plugin): [explicit-function-return-type] afix typecheck* Update packages/eslint-plugin/src/rules/explicit-function-return-type.tsCo-authored-by: Josh Goldberg <me@joshuakgoldberg.com>* feat(eslint-plugin): [explicit-function-return-type] Change to allowedNames to work for object properties and class methods* feat(eslint-plugin): [explicit-function-return-type] Change to allowedNames to work for object properties and class methods* fix(eslint-plugin): [explicit-function-return-type] fix for codecov* fix(eslint-plugin): [explicit-function-return-type] add test* fix(eslint-plugin): [explicit-function-return-type] add test* fix(eslint-plugin): [explicit-function-return-type] fix for codecov* fix(eslint-plugin): [explicit-function-return-type] Change allowedName to not ignore computed propertyCo-authored-by: Josh Goldberg <me@joshuakgoldberg.com>Co-authored-by: Josh Goldberg <joshuakgoldberg@outlook.com>
crapStone pushed a commit to Calciumdibromid/CaBr2 that referenced this pull requestFeb 16, 2022
This PR contains the following updates:| Package | Type | Update | Change ||---|---|---|---|| [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint) | devDependencies | minor | [`5.10.2` -> `5.12.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2feslint-plugin/5.10.2/5.12.0) || [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint) | devDependencies | minor | [`5.10.2` -> `5.12.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2fparser/5.10.2/5.12.0) |---### Release Notes<details><summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/eslint-plugin)</summary>### [`v5.12.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#&#8203;5120-httpsgithubcomtypescript-eslinttypescript-eslintcomparev5110v5120-2022-02-14)[Compare Source](typescript-eslint/typescript-eslint@v5.11.0...v5.12.0)##### Bug Fixes-   **eslint-plugin:** \[init-declarations] fix nested namespace ([#&#8203;4544](typescript-eslint/typescript-eslint#4544)) ([fe910e6](typescript-eslint/typescript-eslint@fe910e6))-   **eslint-plugin:** \[no-unnecessary-type-arguments] Use Symbol to check if it's the same type ([#&#8203;4543](typescript-eslint/typescript-eslint#4543)) ([5b7d8df](typescript-eslint/typescript-eslint@5b7d8df))-   support nested object deconstructuring with type annotation ([#&#8203;4548](typescript-eslint/typescript-eslint#4548)) ([4da9278](typescript-eslint/typescript-eslint@4da9278))##### Features-   add checking property definition for allowNames option ([#&#8203;4542](typescript-eslint/typescript-eslint#4542)) ([e32bef6](typescript-eslint/typescript-eslint@e32bef6))### [`v5.11.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#&#8203;5110-httpsgithubcomtypescript-eslinttypescript-eslintcomparev5102v5110-2022-02-07)[Compare Source](typescript-eslint/typescript-eslint@v5.10.2...v5.11.0)##### Bug Fixes-   **eslint-plugin:** \[no-magic-numbers] fix invalid schema merging ([#&#8203;4517](typescript-eslint/typescript-eslint#4517)) ([b95f796](typescript-eslint/typescript-eslint@b95f796))-   **eslint-plugin:** \[non-nullable-type-assertion-style] fix false positive when asserting to a generic type that might be nullish ([#&#8203;4509](typescript-eslint/typescript-eslint#4509)) ([4209362](typescript-eslint/typescript-eslint@4209362))##### Features-   **eslint-plugin:** \[explicit-function-return-type] add allowedNames ([#&#8203;4440](typescript-eslint/typescript-eslint#4440)) ([936e252](typescript-eslint/typescript-eslint@936e252))#### [5.10.2](typescript-eslint/typescript-eslint@v5.10.1...v5.10.2) (2022-01-31)##### Bug Fixes-   **eslint-plugin:** \[no-restricted-imports] allow relative type imports with patterns configured ([#&#8203;4494](typescript-eslint/typescript-eslint#4494)) ([4a6d217](typescript-eslint/typescript-eslint@4a6d217))#### [5.10.1](typescript-eslint/typescript-eslint@v5.10.0...v5.10.1) (2022-01-24)**Note:** Version bump only for package [@&#8203;typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/eslint-plugin)</details><details><summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/parser)</summary>### [`v5.12.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#&#8203;5120-httpsgithubcomtypescript-eslinttypescript-eslintcomparev5110v5120-2022-02-14)[Compare Source](typescript-eslint/typescript-eslint@v5.11.0...v5.12.0)**Note:** Version bump only for package [@&#8203;typescript-eslint/parser](https://github.com/typescript-eslint/parser)### [`v5.11.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#&#8203;5110-httpsgithubcomtypescript-eslinttypescript-eslintcomparev5102v5110-2022-02-07)[Compare Source](typescript-eslint/typescript-eslint@v5.10.2...v5.11.0)**Note:** Version bump only for package [@&#8203;typescript-eslint/parser](https://github.com/typescript-eslint/parser)#### [5.10.2](typescript-eslint/typescript-eslint@v5.10.1...v5.10.2) (2022-01-31)**Note:** Version bump only for package [@&#8203;typescript-eslint/parser](https://github.com/typescript-eslint/parser)#### [5.10.1](typescript-eslint/typescript-eslint@v5.10.0...v5.10.1) (2022-01-24)**Note:** Version bump only for package [@&#8203;typescript-eslint/parser](https://github.com/typescript-eslint/parser)</details>---### Configuration📅 **Schedule**: At any time (no schedule defined).🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.♻ **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found.🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.--- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.---This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).Co-authored-by: cabr2-bot <cabr2.help@gmail.com>Co-authored-by: crapStone <crapstone@noreply.codeberg.org>Reviewed-on:https://codeberg.org/Calciumdibromid/CaBr2/pulls/1157Reviewed-by: crapStone <crapstone@noreply.codeberg.org>Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsMay 26, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@bradzacherbradzacherbradzacher approved these changes

@JoshuaKGoldbergJoshuaKGoldbergAwaiting requested review from JoshuaKGoldberg

Assignees

No one assigned

Labels

awaiting responseIssues waiting for a reply from the OP or another partyenhancement: plugin rule optionNew rule option for an existing eslint-plugin rule

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[explicit-function-return-type] add an exclude list option

3 participants

@islandryu@JoshuaKGoldberg@bradzacher

[8]ページ先頭

©2009-2025 Movatter.jp