Socket
Socket
Sign inDemoInstall

eslint-teamcity

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-teamcity - npm Package Compare versions

Comparing version 1.3.1 to 1.4.0

test/base.spec.js

20

index.js

@@ -0,3 +1,21 @@

#!/usr/bin/env node
'use strict';
var fs = require('fs-extra'),
procArg = process.argv;
module.exports = require('./src/formatter');
if (require.main === module) {
process.stdout.write(main(fs.readJSONSync(procArg[2])))
} else {
module.exports = main;
}
/**
* main function
* @param {String} input - input data stringify json
* @param {Object} [teamcityPropNames] - names of the vars
* @returns {String} format result
*/
function main(input, teamcityPropNames) {
return require('./src/formatter')(input, teamcityPropNames);
}

25

package.json
{
"name": "eslint-teamcity",
"version": "1.3.1",
"version": "1.4.0",
"description": "An ESLint formatter plugin for TeamCity",
"main": "index.js",
"scripts": {
"test": "./node_modules/mocha/bin/mocha ./test/",
"test-travis": "./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- -R spec ./test/*"
"test": "./node_modules/mocha/bin/mocha ./test/*.spec.js",
"test-travis": "./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- -R spec ./test/*.spec.js"
},

@@ -17,5 +17,6 @@ "repository": {

"teamcity",
"formatter"
"formatter",
"linting"
],
"author": "Andre Ogle <ogleandre@yahoo.com> (https://github.com/andreogle)",
"author": "Andre Ogle <ogleandre@gmail.com> (https://github.com/andreogle)",
"license": "MIT",

@@ -27,8 +28,12 @@ "bugs": {

"chai": "^3.5.0",
"coveralls": "^2.11.8",
"eslint": "^3.8.1",
"istanbul": "^0.4.2",
"mocha": "^2.4.5",
"sinon": "^1.17.6"
"coveralls": "^2.12.0",
"eslint": "^3.18.0",
"istanbul": "^0.4.5",
"mocha": "^3.2.0",
"shelljs": "^0.7.8",
"sinon": "^2.1.0"
},
"dependencies": {
"fs-extra": "^3.0.1"
}
}

@@ -10,7 +10,7 @@ # eslint-teamcity

[TeamCity](https://www.jetbrains.com/teamcity/) build error format. Tested with
TeamCity 9.1.x/10.0.x and ESLint 1/2/3.
TeamCity 9.1.x/10.0.x/2017 and ESLint 1/2/3/4.
## Installation
[Use npm](https://docs.npmjs.com/cli/install).
Prerequisite: You must have either [npm](https://docs.npmjs.com/cli/install) or [Yarn](https://yarnpkg.com/en/docs/install) installed.

@@ -22,17 +22,35 @@ ```sh

## Usage
There are currently 3 ways to use eslint-teamcity:
##### As a regular ESLint formatter plugin:
```sh
eslint --format './node_modules/eslint-teamcity/index.js' myfiletolint.js
eslint --format ./node_modules/eslint-teamcity/index.js myfiletolint.js
```
##### Running against a generated ESLint JSON report:
Generate an ESLint JSON report:
```sh
eslint -f json -o result.json app/myjavascriptdirectory
```
Run eslint-teamcity against the new report:
```sh
node ./node_modules/eslint-teamcity/index.js result.json
```
##### Requiring and running directly from inside your JavaScript code:
```javascript
var eslintTeamcity = require('eslint-teamcity');
console.log(eslintTeamcity(result));
```
## [gulp-eslint](https://github.com/adametry/gulp-eslint) integration
```javascript
var gulp = require('gulp'),
eslint = require('gulp-eslint'),
teamcity = require('eslint-teamcity');
var gulp = require('gulp');
var eslint = require('gulp-eslint');
var teamcity = require('eslint-teamcity');
gulp.task('lint', function () {
return gulp.src(['js/**/*.js'])
.pipe(eslint())
.pipe(eslint.format(teamcity))
.pipe(eslint.failAfterError());
return gulp.src(['js/**/*.js'])
.pipe(eslint())
.pipe(eslint.format(teamcity))
.pipe(eslint.failAfterError());
});

@@ -39,0 +57,0 @@ ```

@@ -35,12 +35,18 @@ /**

var reportName = 'ESLint Violations';
//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------
module.exports = function(results) {
module.exports = function(results, teamcityPropNames) {
var output = '';
var errorCount = 0;
var warningCount = 0;
var reportName;
var errorCountName;
var warningCountName;
var varNames = teamcityPropNames || {};
reportName = varNames.reportName || 'ESLint Violations';
errorCountName = varNames.errorCountName || 'ESLintErrorCount';
warningCountName = varNames.warningCountName || 'ESLintWarningCount';
output += '##teamcity[testSuiteStarted name=\'' + reportName + '\']\n';

@@ -90,6 +96,6 @@

output += '##teamcity[buildStatisticValue key=\'ESLintErrorCount\' value=\'' + errorCount +'\' ]\n';
output += '##teamcity[buildStatisticValue key=\'ESLintWarningCount\' value=\'' + warningCount +'\' ]\n';
output += '##teamcity[buildStatisticValue key=\'' + errorCountName + '\' value=\'' + errorCount +'\' ]\n';
output += '##teamcity[buildStatisticValue key=\'' + warningCountName + '\' value=\'' + warningCount +'\' ]\n';
return output;
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc