As of v2.0, Node v6+ is required. If you use an older version of Node, please stick with v1.x
npm install eslint-teamcity --save-dev
There are 3 ways to use eslint-teamcity:
1. As a regular ESLint formatter plugin:
eslint --format ./node_modules/eslint-teamcity/index.js myfiletolint.js
2. Running against a generated ESLint JSON report:
Generate an ESLint JSON report:
Run eslint-teamcity against your new report:
node ./node_modules/eslint-teamcity/index.js result.json
const eslintTeamcity = ;console;
As of version 2.0, there are two different formatters you can use to report with. They have no material impact on the output - they're just different ways of viewing the same data. The "Code Inspection" tab will only appear if you have configured eslint-teamcity to use the inspections reporter.
There are several ways that you can configure eslint-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
const eslintTeamcity = ;const options =reporter: 'inspections' // default: 'errors'reportName: 'My ESLint Violations' // default: 'ESLint Violations'errorStatisticsName: 'My ESLint Error Count' // default: 'ESLint Error Count'warningStatisticsName: 'My ESLint Warning Count' // default: 'ESLint Warning Count';console;
2. From your package.json
If you have a package.json file in the current directory, you can add an extra "eslint-teamcity" property to it:
3. ENV variables
export ESLINT_TEAMCITY_REPORTER=inspectionsexport ESLINT_TEAMCITY_REPORT_NAME="My Formatting Problems"export ESLINT_TEAMCITY_ERROR_STATISTICS_NAME="My Error Count"export ESLINT_TEAMCITY_WARNING_STATISTICS_NAME="My Warning Count"
You can also output your current settings to the log if you set:
const gulp = ;const eslint = ;const teamcity = ;gulp;
See the gulp-eslint docs for more info on setting up a linting task.
The simplest way to run eslint-teamcity is from an npm script in a build step. You could setup a script similar to this:
Kick off a new build, by deploying again, and you should see your build errors - assuming you have any!
eslint-teamcity will also output statistic values which you can use in TeamCity to track your progress in resolving errors!
Graphs can be setup from the Build -> Statistics tab.
The quickest way to get a TeamCity server setup is to use Docker:
docker run -itd --name teamcity-server \-v <path to data directory>:/data/teamcity_server/datadir \-v <path to logs directory>:/opt/teamcity/logs \-p 8111:8111 \jetbrains/teamcity-serverdocker run -itd -e SERVER_URL="<your ip4 address>:8111" \-v <path to agent config folder>:/data/teamcity_agent/conf \jetbrains/teamcity-agent
If you fork the repo and are testing on your local TeamCity instance, it may help to run
rm -rf node_modules in a
build step as TeamCity seems to cache versions between commits.
I will try keep this project up to date, but please log any issues here. Any pull requests are also welcome!