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

Refactor a bunch of tests to use template literal syntax instead of [].join( #1423

Merged
merged 32 commits into from Oct 3, 2017

Conversation

jseminck
Copy link
Contributor

@jseminck jseminck commented Sep 10, 2017

I wanted to experiment writing a code mod and decided to write one to transform the code: [].join('\n'); syntax to use template literals instead.

I ran it on a file by file basis. I could not transform all the files yet because template literals introduce the following issues:

  • Error lines / columns are different. Since my syntax adds 1 extra line + a lot of indentation, those numbers change
  • Output often also doesn't work because of the added indentation in the code through the template literal sting

But a lot of files didn't rely on this so at least we could start with transforming those 😄

Here's the codemod code: https://astexplorer.net/#/gist/000b6e8110a245ca6384c260b954e452/1687ee893085fdae7119c809294e5ed43a3fe428

options: [{
rule: '^is[A-Z]([A-Za-z0-9]?)+'
}],
parser: 'babel-eslint'
}, {
// Functional components and Flowtype booleans
Copy link
Member

Choose a reason for hiding this comment

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

looks like your codemod removed a bunch of comments. please restore them all

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Woops! My bad... I found the mistake 😄 I'll re-add all of them. I think most are actually in this rule where every test has a comment.

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

LGTM; it'd be good to rebase and re-run the codemod, just in case

@ljharb
Copy link
Member

ljharb commented Oct 3, 2017

@jseminck would you mind one more rebase and rerun? Please ping me when its done and I'll merge asap. Thanks!

@sergeysova
Copy link

@ljharb @jseminck maybe squash and merge?

@ljharb
Copy link
Member

ljharb commented Oct 3, 2017

@lestad a) the issue is with staleness, not with "i only want one commit", b) github's squashmerge and rebase merge are terrible features that pollute the git log; rebasing PRs and using a fast-forwardable merge commit is far superior.

@jseminck
Copy link
Contributor Author

jseminck commented Oct 3, 2017

I don't think any changes have been done in master that affect this. Will check!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants