eslint-formatter-teamcity

raw JSON →
2.0.1 verified Sat Apr 25 auth: no javascript

ESLint formatter that outputs violations in TeamCity build error format. Current version 2.0.1 (released 2023-08-01). Zero runtime dependencies since v2.0.0 (uses only Node.js built-ins). Supports ESM and CommonJS. Ships TypeScript types. Configurable via function argument, package.json, or environment variables. Tested with TeamCity 9.1.x/10.0.x/2017+ and ESLint 1+. Key differentiator: designed specifically for TeamCity CI integration with both errors and inspections reporters.

error Error: Cannot find module 'eslint-formatter-teamcity'
cause The package is not installed or not in the current working directory's node_modules.
fix
Run npm install eslint-formatter-teamcity --save-dev and ensure you are running the command from the project root.
error TypeError: eslintTeamcity is not a function
cause Incorrect import style; likely used named import when package has a default export only.
fix
Use default import: import eslintTeamcity from 'eslint-formatter-teamcity' (no curly braces).
error ESLint: Unknown formatter 'teamcity'
cause The formatter is not installed or ESLint cannot find it (e.g., running from wrong directory).
fix
Install as devDependency: npm install eslint-formatter-teamcity --save-dev and run ESLint from the project root.
error Type error: Could not find a declaration file for module 'eslint-formatter-teamcity'
cause Package version <2.0.1 did not ship TypeScript types.
fix
Upgrade to v2.0.1 or later, or create a custom declaration file (declare module 'eslint-formatter-teamcity').
breaking v2.0.0 removed the fs-extra dependency. If your project depends on fs-extra being hoisted by eslint-formatter-teamcity, you must add it as a direct dependency.
fix Add `fs-extra` to your own `package.json` if you were relying on it transitively.
deprecated The old package name `eslint-teamcity` is deprecated. Use `eslint-formatter-teamcity` instead.
fix Update your `package.json` to depend on `eslint-formatter-teamcity` and change all imports.
gotcha TypeScript types were missing before v2.0.1. Upgrading from v2.0.0 to v2.0.1 may cause TypeScript errors if you had workarounds.
fix Upgrade to v2.0.1 or later for proper type resolution.
gotcha CLI formatter name is `teamcity`, not `eslint-formatter-teamcity`. Running `eslint --format eslint-formatter-teamcity` will fail.
fix Use `eslint --format teamcity` (without the `eslint-formatter-` prefix).
gotcha When using the formatter programmatically, you must pass the ESLint results object (as returned by `ESLint.lintFiles()` or `CLIEngine.executeOnFiles()`), not the raw file contents.
fix Call `eslintTeamcity(eslintOutput)` where `eslintOutput` is the full results array or object from ESLint.
npm install eslint-formatter-teamcity
yarn add eslint-formatter-teamcity
pnpm add eslint-formatter-teamcity

Install the package, create a minimal ESLint config and a file with a lint violation, then run ESLint with the TeamCity formatter to see service messages.

# Install as dev dependency
npm install eslint-formatter-teamcity --save-dev

# Create an ESLint config file (.eslintrc.json or similar)
echo '{}' > .eslintrc.json

# Create a test file with a lint violation (e.g., unused variable)
echo 'let x = 1;' > test.js

# Run ESLint with the TeamCity formatter (short name, no namespace)
eslint --format teamcity test.js

# Expected output:
# ##teamcity[testSuiteStarted name='ESLint Violations']
# ##teamcity[testStarted name='test.js: let is not defined']
# ##teamcity[testFailed name='test.js: let is not defined' message='Error: ESLint - let is not defined' details='...']
# ##teamcity[testSuiteFinished name='ESLint Violations']