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

Fixed typescript props bug and added typescript compile to linting process #1485

Merged
merged 1 commit into from
Feb 6, 2020

Conversation

mariano-formidable
Copy link
Member

@mariano-formidable mariano-formidable commented Feb 6, 2020

This PR fixes a small bug I found in the typescript definitions that wasn't caught by eslint.

After some googling, I realized that typescript-eslint does not catch very specific typescript errors (like interface errors, or type mis-match errors). So the best way to ensure that all the typescript code (and definition files) are correct is to use tsc to compile the typescript files in the project. tsc will catch any type errors that typescript-eslint misses.

So, I added lint.ts to our linting pipeline. It will simply build the typescript files (with no output generated thanks to the noEmit flag) and report any build errors. This caught the bug in our definitions, so I was able to fix it and re-lint and voila things are working!

Note: The bug was that VictoryCommonProps and another interface both defined the same prop categories (it was a mistake I introduced when fleshing out the demos). This isn't a breaking bug, just an annoying warning about duplicate definitions.

)
},
format: {
default: 'prettier --write "./**/*.{js,jsx,json,ts,tsx}"',
ci: 'prettier --list-different "./**/*.{js,jsx,json,ts,tsx}"'
},
check: {
ci: npsUtils.series.nps("format.ci", "lint", "test.ci"),
ci: npsUtils.series.nps("format.ci", "lint", "karma.ci"),
Copy link
Member Author

Choose a reason for hiding this comment

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

The lint process for typescript involves running build-package-libs, which test.ci also did, so I removed test.ci and replaced it with karma.ci since the packages will already be built for karma.

Let me know if this doesn't make sense or might produce some other problems, I just didn't want build-package-libs to run twice during ci if we didn't need it.

@mariano-formidable mariano-formidable changed the title [WIP] Fixed typescript props bug and added typescript compile to linting process Fixed typescript props bug and added typescript compile to linting process Feb 6, 2020
@boygirl
Copy link
Contributor

boygirl commented Feb 6, 2020

@mariano-formidable ci logs for these changes all look good. Thank you for this fix!

@boygirl boygirl merged commit 664f5fc into master Feb 6, 2020
@boygirl boygirl deleted the fix/typescript-defs branch February 6, 2020 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants