Skip to content

Conversation

@gkjohnson
Copy link
Collaborator

@gkjohnson gkjohnson commented May 20, 2019

As discussed in #16449 this PR adds support for linting the typescript definition files using the existing eslint rules. This means that Travis builds will fail if the typescript definition files in /src are not linted properly and the .d.ts files can be automatically fixed using npm run lint -- --fix.

In order to get VSCode to display lint errors inline I had to add "typescript" to the "eslint.validate" options like so:

"eslint.validate": [ "javascript", "javascriptreact", "html", "typescript" ]

The caveat here is that in d.ts files the linter seems to see the imported objects as "unused-variables" for some reason even when they're used in function signatures. For example:

If this is merged then --fix should be run and then the d.ts changes committed into the dev branch.

Edit: I've fixed the caveat

@gkjohnson
Copy link
Collaborator Author

If it's unclear the Travis CI is expected to fail until all the d.ts files are properly linted, which I think should happen by running npm run lint -- --fix after this is merged!

@mrdoob mrdoob added this to the r105 milestone May 28, 2019
@mrdoob mrdoob merged commit bf32911 into mrdoob:dev May 28, 2019
@mrdoob
Copy link
Owner

mrdoob commented May 28, 2019

Thanks!

@mrdoob
Copy link
Owner

mrdoob commented May 28, 2019

Looks good? 5cd59cb
I can see still some indentation inconsistencies... 🤔

@gkjohnson
Copy link
Collaborator Author

@mrdoob any specific places? I can look into a bit more when I get a chance -- maybe it's less clear through the Github UI.

@gkjohnson gkjohnson deleted the lint-ts-files branch May 28, 2019 15:57
@mrdoob
Copy link
Owner

mrdoob commented May 28, 2019

If you search for OrthographicCamera.d.ts in that commit you'll see what I mean. Some constructors and comments get extra indent.

@gkjohnson
Copy link
Collaborator Author

Oh I see:

	/**
   * @param left Camera frustum left plane.
   * @param right Camera frustum right plane.
   * @param top Camera frustum top plane.
   * @param bottom Camera frustum bottom plane.
   * @param near Camera frustum near plane.
   * @param far Camera frustum far plane.
   */
	constructor(
    left: number,
    right: number,
    top: number,
    bottom: number

It looks like it's due to space / tab indent inconsistency. I'll have to look into why it didn't auto-fix those.

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.

3 participants