npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tslint-teamcity-reporter

v3.2.2

Published

A TSLint formatter/reporter for use in TeamCity which groups by files using TeamCity Test Suite

Downloads

5,249

Readme

tslint-teamcity-reporter

A TSLint formatter/reporter for use in TeamCity which groups by files using TeamCity Test Suite

Note: v3.0.0 is completely rewritten to keep it more maintainable (borrowing from eslint-teamcity and tslint internal tests), and will be a breaking change to your configuration and output.

Changes

  • From the CLI, the formatter can now be specified as -t ./node_modules/tslint-teamcity-reporter/index.js
  • The lint errors reported as tests are now grouped by file
    • This means that on the top-level, you only see failed files, not individual errors
    • The individual errors are now displayed as error output for each file
    • This means that the 'failed test count' will drop significantly, please take into account in your overall metrics
    • If you liked the old approach better, please let me know in a ticket, and I can add it back as an option
  • Warnings are now treated as such, will show up in the logs and at the bottom of a failed test

Installation

yarn add tslint-teamcity-reporter
npm i -D tslint-teamcity-reporter

Usage

Use it with:

TSLint CLI

tslint files/**/*.ts -t ./node_modules/tslint-teamcity-reporter/index.js

grunt-tslint

module.exports = grunt => {
  grunt.loadNpmTasks('grunt-tslint');

  grunt.initConfig({
    tslint: {
      options: {
        configuration: './tslint.json',
        formatter: 'tslint-teamcity-reporter',
      },
      files: {
        src: ['**/*.ts'],
      },
    },
  });

  grunt.registerTask('default', ['tslint']);
};

gulp-tslint

const gulp = require('gulp');
const tslint = require('gulp-tslint');

gulp.task('tslint', () =>
  gulp
    .src('**/*.ts')
    .pipe(
      tslint({
        configuration: './tslint.json',
        formatter: 'tslint-teamcity-reporter',
        formattersDirectory: 'anything-but-falsy', // passing a falsy value will resolve in `null` and throw an error in tslint
      }),
    )
    .pipe(tslint.report()),
);

gulp.task('default', ['tslint']);

Configuration

There are several ways that you can configure tslint-teamcity. You don't have to configure anything by default, you just have the option to if you would like. Settings are looked for in the following priority:

1. As a second argument

If you run tslint-teamcity-reporter by requiring it in your code, you can pass a second argument to the function:

import { Formatter } from 'tslint-teamcity-reporter';

const formatter = new Formatter();
const options = {
  reporter: 'inspections',
  reportName: 'My TSLint Violations',
  errorStatisticsName: 'My TSLint Error Count',
  warningStatisticsName: 'My TSLint Warning Count',
};
console.log(formatter.format(tslintFailures, options));

2. From your package.json

If you have a package.json file in the current directory, you can add an extra "tslint-teamcity-reporter" property to it:

{
  "tslint-teamcity-reporter": {
    "reporter": "inspections",
    "report-name": "My TSLint Violations",
    "error-statistics-name": "My TSLint Error Count",
    "warning-statistics-name": "My TSLint Warning Count"
  }
}

3. ENV variables

export TSLINT_TEAMCITY_REPORTER="inspections"
export TSLINT_TEAMCITY_REPORT_NAME="My Formatting Problems"
export TSLINT_TEAMCITY_ERROR_STATISTICS_NAME="My Error Count"
export TSLINT_TEAMCITY_WARNING_STATISTICS_NAME="My Warning Count"

You can also output your current settings to the log if you set:

export TSLINT_TEAMCITY_DISPLAY_CONFIG=true

Output type

By default, the output is displayed as tests on a TeamCity build ("reporter": "errors"). You can change it to be displayed as "Inspections" in a separate tab by setting the "reporter": "inspections" option.

Building

In order to build tslint-teamcity-reporter, ensure that you have Git and Node.js installed.

Clone a copy of the repo:

git clone https://github.com/ThaNarie/tslint-teamcity-reporter.git

Change to the tslint-teamcity-reporter directory:

cd tslint-teamcity-reporter

Install dev dependencies:

yarn

Use one of the following main scripts:

yarn build            # build this project
yarn dev              # run compilers in watch mode, both for babel and typescript
yarn test             # run the unit tests incl coverage
yarn test:dev         # run the unit tests in watch mode
yarn lint             # run eslint and tslint on this project

When installing this module, it adds a pre-commit hook, that runs lint and prettier commands before committing, so you can be sure that everything checks out.

Contribute

View CONTRIBUTING.md

LICENSE

Thanks to eslint-teamcity, jshint-teamcity and tslint.

MIT © Tha Narie