microsoft / microsoft/TypeScript

--format=checkstyle option for tsc --noEmit

Open
#42,453 3 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting More Feedback Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

Suggestion

🔍 Search Terms

Checkstyle

✅ Viability Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

⭐ Suggestion

We have automated checking for typescript errors in our CI tooling (Jenkins), using the following command ./node_modules/.bin/tsc --project ./tsconfig.json --noEmit > build-logs/typescript-error.log. Currently we save the output to a plaint text file, but we would like to be able to parse it in our CI. The standards most tooling follows is a format option which supports a checkstyle format, which can easily be parsed by most CI's.

See https://checkstyle.sourceforge.io/config.html#Configuration_XML_Structure for more information on how to format the xml.

It would be great to have a --format=checkstyle option we could add to our current command to get a formatted xml file with all errors.

📃 Motivating Example

Most of our current tooling already supports this, and this enables us to check code quality, fail builds, etc.
Screenshot 2021-01-22 at 10 28 59

💻 Use Cases

We currently have checks for stylelint, eslint, php codesniffer, phpstan, psalm and htmlhint. It would be great if we could also easily identify and report which typescript errors exist within our projects and possibly fail a build if we encounter them.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the tsc --project ./tsconfig.json --noEmit command and inspect how its diagnostics are currently written to build-logs/typescript-error.log. Review the Checkstyle XML structure linked in the issue and determine how reported errors should map to it; done means --format=checkstyle produces parseable XML without changing existing output.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.