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

Format all TypeScript files with Prettier through TSLint #1529

Merged
merged 3 commits into from
Feb 5, 2019

Conversation

pugnascotia
Copy link
Contributor

Summary

I had a spare 20 minutes, so I added Prettier into the TSLint config and formatted all the TypeScript files. As we migrate more files to TS, they'll get formatted too.

Checklist

  • This was checked in mobile
  • This was checked in IE11
  • This was checked in dark mode
  • Any props added have proper autodocs
  • Documentation examples were added
  • A changelog entry exists and is marked appropriately
  • This was checked for breaking changes and labeled appropriately
  • Jest tests were updated or added to match the most common scenarios
  • This was checked against keyboard-only and screenreader scenarios
  • This required updates to Framer X components

@chandlerprall
Copy link
Contributor

chandlerprall commented Feb 5, 2019

Think we should set jsxSingleQuote to false, better matches our existing pattern and, from I've seen, everyone else but Cloud does double quotes on JSX attributes.

@pugnascotia
Copy link
Contributor Author

Tweaked the config

Copy link
Contributor

@chandlerprall chandlerprall left a comment

Choose a reason for hiding this comment

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

LGTM

@snide
Copy link
Contributor

snide commented Feb 5, 2019

Yay for linting.

Only one that seemed a little off was not breaking props up per line. Looks like this may only happen when it's closed?

image

I really don't care to argue about it though, so if @chandlerprall is good, I'm good with it and things will automatically get changed on save for me :)

@pugnascotia
Copy link
Contributor Author

Those lines will break when they’re over 80 columns. It how the formatting algorithm works.

@pugnascotia pugnascotia merged commit 4b5987c into elastic:master Feb 5, 2019
@pugnascotia pugnascotia deleted the use-prettier branch February 5, 2019 22:27
pugnascotia added a commit that referenced this pull request Feb 7, 2019
…1538)

Now that we've merged #1529, all TypeScript files will trigger lint
warnings if their formatting needs updating with Prettier (which can be
done by fixing with the linter). So far, so good.

However, the Webpack config for `src-docs` pulls in the project's
TypesScript and TSLint settings, meaning that Webpack won't compile any TS
files that have lint problems. We don't need checking at this stage to be
so strict, because the pre-commit hook and general lint task already check
everything.

So, in order to stop docs development from being annoying, I've customised
the TSLint settings when running `src-docs` so that lint problems are now
warnings, instead of errors. They'll still have to get fixed before
committing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants