Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Added fixer for newline-before-return rule #4482

Merged

Conversation

jukben
Copy link
Contributor

@jukben jukben commented Jan 26, 2019

PR checklist

  • Addresses an existing issue: #0000
  • New feature, bugfix, or enhancement
    • Includes tests
  • Documentation update

Overview of change:

I've realized that newline-before-return didn't have a fixer which seems to be quite straightforward. Here are my two cents.

I've added tests and everything seems OK.

Is there anything you'd like reviewers to focus on?

CHANGELOG.md entry:

[new-fixer] added fixer for newline-before-return rule

@palantirtech
Copy link
Member

Thanks for your interest in palantir/tslint, @jukben! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request.

@jukben jukben force-pushed the feature/newline-before-return-fixer branch 4 times, most recently from a27f247 to f9f4e7d Compare January 26, 2019 15:28
Copy link
Contributor

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Great idea, thanks for getting started on this! Some touchup suggestions around sharing code with existing rules that do similar things.

const fixer = Lint.Replacement.replaceFromTo(
start - indentationCurrent.length,
start,
line === prevLine ? `\n\n${indentationPrev}` : `\n${indentationCurrent}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

\n

This'll need to adjust to projects where \r\n is the line feed, such as Git with CRLF (aka Windows). curlyRule.ts checks the last character of a relevant source line to see which to use, for example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a very good point, haven't thought about it. I've introduced function in utils to solve that. 👍

src/rules/newlineBeforeReturnRule.ts Outdated Show resolved Hide resolved
@jukben
Copy link
Contributor Author

jukben commented Jan 26, 2019

Hey, @JoshuaKGoldberg thank you for the feedback, wouldn't you mind do me another review? 🙏

@jukben jukben force-pushed the feature/newline-before-return-fixer branch from 36c53b1 to 8aaec1c Compare January 29, 2019 22:35
@jukben jukben force-pushed the feature/newline-before-return-fixer branch from 8aaec1c to 37646c5 Compare January 29, 2019 22:53
@adidahiya
Copy link
Contributor

@jukben have you signed the CLA? also please avoid force-pushing to PRs in this project, it's easier to review if you just add additional commits. they all get squashed at the end of the PR.

@jukben
Copy link
Contributor Author

jukben commented Feb 2, 2019

@adidahiya yes I have signed the CLA already.

You signed the individual CLA on January 26, 2019 at 4:19 PM.

Anyway, sorry for the force-push I’m aware of this, I haven’t been adding new commits I was just trying to unblock/resolve this because of conflicts coming from the master (#4420). Should I use a merge strategy next time?

P.S: I already had that check green, maybe rerun it would do the trick?

cc @JoshuaKGoldberg

@adidahiya
Copy link
Contributor

@jukben yes you can use a merge strategy from master. hmm it looks like our CLA bot might be buggy, it also failed to report status on one of my PRs recently. would you mind posting a screenshot of where you saw that text "you signed the individual CLA..."? thanks

@jukben
Copy link
Contributor Author

jukben commented Feb 3, 2019

@adidahiya Makes sense, next time I'll do it like this to avoid any force-push when PR is being reviewed. 👍

screenshot 2019-02-03 at 17 29 48

Is this enough? 🙏

@jukben
Copy link
Contributor Author

jukben commented Feb 5, 2019

Could we please unblock it? @JoshuaKGoldberg @adidahiya

@adidahiya adidahiya removed PR: waiting for CLA Waiting for the author to sign the CLA PR: waiting for reviewer labels Feb 5, 2019
@adidahiya adidahiya merged commit a7c86fa into palantir:master Feb 5, 2019
@jukben
Copy link
Contributor Author

jukben commented Feb 5, 2019

@adidahiya :shipit: ❤️

Could I somewhere get the information how releases are planned? Just to plan when it will be possible to intercorporate it cleanly to my project?

@adidahiya
Copy link
Contributor

the release schedule is pretty ad-hoc right now, but I'll try to cut a release this week

@jukben jukben mentioned this pull request Feb 5, 2019
4 tasks
@jukben jukben deleted the feature/newline-before-return-fixer branch March 26, 2019 09:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants