Skip to content
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

fix(eslint-plugin): [promise-function-async] bad fixer with computed and literal methods #3163

Merged
merged 3 commits into from Mar 18, 2021
Merged

Conversation

phaux
Copy link
Contributor

@phaux phaux commented Mar 10, 2021

  • Fixer for public"foo"() {} now adds a space so it doesn't become publicasync "foo"() {}
  • Fixer for ["computed"]() {} now inserts async in the correct position instead of [async "computed"]() {}

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @phaux!

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 on https://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day.

@codecov
Copy link

codecov bot commented Mar 10, 2021

Codecov Report

Merging #3163 (c35ef36) into master (d3086d8) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #3163   +/-   ##
=======================================
  Coverage   92.91%   92.92%           
=======================================
  Files         316      316           
  Lines       10808    10820   +12     
  Branches     3056     3059    +3     
=======================================
+ Hits        10042    10054   +12     
  Misses        342      342           
  Partials      424      424           
Flag Coverage Δ
unittest 92.92% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
.../eslint-plugin/src/rules/promise-function-async.ts 98.03% <100.00%> (+0.60%) ⬆️
.../eslint-plugin/src/util/explicitReturnTypeUtils.ts 100.00% <0.00%> (ø)

@bradzacher bradzacher added the bug Something isn't working label Mar 10, 2021
@bradzacher bradzacher changed the title fix(eslint-plugin): prom-func-async fixer bug fix(eslint-plugin): [promise-function-async] bad fixer with computed and literal methods Mar 15, 2021
Copy link
Member

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

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

Thanks for your fix!
code itself LGTM - one comment.

TSESTree,
} from '@typescript-eslint/experimental-utils';
import { last } from 'lodash';
Copy link
Member

Choose a reason for hiding this comment

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

we'd rather avoid adding a dependency on lodash for such trivial things.
Please inline the function impl!

// this function is a class method or object function property shorthand
const method = node.parent;

/** the token to put `async` before */
Copy link
Member

Choose a reason for hiding this comment

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

nitpick

Suggested change
/** the token to put `async` before */
/// the token to put `async` before

@bradzacher bradzacher added the awaiting response Issues waiting for a reply from the OP or another party label Mar 15, 2021
@bradzacher bradzacher removed the awaiting response Issues waiting for a reply from the OP or another party label Mar 16, 2021
Copy link
Member

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

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

thanks for fixing this!

@bradzacher bradzacher merged commit e3a3ea0 into typescript-eslint:master Mar 18, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants