initial commit
This commit is contained in:
25
node_modules/tslint/lib/formatters/checkstyleFormatter.d.ts
generated
vendored
Normal file
25
node_modules/tslint/lib/formatters/checkstyleFormatter.d.ts
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2018 Palantir Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { AbstractFormatter } from "../language/formatter/abstractFormatter";
|
||||
import { IFormatterMetadata } from "../language/formatter/formatter";
|
||||
import { RuleFailure } from "../language/rule/rule";
|
||||
export declare class Formatter extends AbstractFormatter {
|
||||
static metadata: IFormatterMetadata;
|
||||
format(failures: RuleFailure[], _fixes?: RuleFailure[], fileNames?: string[]): string;
|
||||
private formatFailure;
|
||||
private escapeXml;
|
||||
}
|
||||
82
node_modules/tslint/lib/formatters/checkstyleFormatter.js
generated
vendored
Normal file
82
node_modules/tslint/lib/formatters/checkstyleFormatter.js
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2018 Palantir Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
|
||||
var Utils = require("../utils");
|
||||
var Formatter = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(Formatter, _super);
|
||||
function Formatter() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
/* tslint:enable:object-literal-sort-keys */
|
||||
Formatter.prototype.format = function (failures, _fixes, fileNames) {
|
||||
var _this = this;
|
||||
var groupedFailures = {};
|
||||
for (var _i = 0, failures_1 = failures; _i < failures_1.length; _i++) {
|
||||
var failure = failures_1[_i];
|
||||
var fileName = failure.getFileName();
|
||||
if (groupedFailures[fileName] !== undefined) {
|
||||
groupedFailures[fileName].push(failure);
|
||||
}
|
||||
else {
|
||||
groupedFailures[fileName] = [failure];
|
||||
}
|
||||
}
|
||||
if (fileNames === undefined) {
|
||||
fileNames = Object.keys(groupedFailures);
|
||||
}
|
||||
var formattedFiles = fileNames.map(function (fileName) {
|
||||
var formattedFailures = groupedFailures[fileName] !== undefined
|
||||
? groupedFailures[fileName].map(function (f) { return _this.formatFailure(f); })
|
||||
: [];
|
||||
var joinedFailures = formattedFailures.join(""); // may be empty
|
||||
return "<file name=\"" + _this.escapeXml(fileName) + "\">" + joinedFailures + "</file>";
|
||||
});
|
||||
var joinedFiles = formattedFiles.join("");
|
||||
return "<?xml version=\"1.0\" encoding=\"utf-8\"?><checkstyle version=\"4.3\">" + joinedFiles + "</checkstyle>";
|
||||
};
|
||||
Formatter.prototype.formatFailure = function (failure) {
|
||||
var line = failure.getStartPosition().getLineAndCharacter().line + 1;
|
||||
var column = failure.getStartPosition().getLineAndCharacter().character + 1;
|
||||
var severity = failure.getRuleSeverity();
|
||||
var message = this.escapeXml(failure.getFailure());
|
||||
// checkstyle parser wants "source" to have structure like <anything>dot<category>dot<type>
|
||||
var source = "failure.tslint." + this.escapeXml(failure.getRuleName());
|
||||
return "<error line=\"" + line + "\" column=\"" + column + "\" severity=\"" + severity + "\" message=\"" + message + "\" source=\"" + source + "\" />";
|
||||
};
|
||||
Formatter.prototype.escapeXml = function (str) {
|
||||
return str
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
.replace(/'/g, "'")
|
||||
.replace(/"/g, """);
|
||||
};
|
||||
/* tslint:disable:object-literal-sort-keys */
|
||||
Formatter.metadata = {
|
||||
formatterName: "checkstyle",
|
||||
description: "Formats errors as though they were Checkstyle output.",
|
||||
descriptionDetails: Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Imitates the XMLLogger from Checkstyle 4.3. All failures have the 'warning' severity. Files without errors are still included."], ["\n Imitates the XMLLogger from Checkstyle 4.3. All failures have the 'warning' severity. Files without errors are still included."]))),
|
||||
sample: Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n <?xml version=\"1.0\" encoding=\"utf-8\"?>\n <checkstyle version=\"4.3\">\n <file name=\"myFile.ts\">\n <error line=\"1\" column=\"14\" severity=\"warning\" message=\"Missing semicolon\" source=\"failure.tslint.semicolon\" />\n </file>\n </checkstyle>"], ["\n <?xml version=\"1.0\" encoding=\"utf-8\"?>\n <checkstyle version=\"4.3\">\n <file name=\"myFile.ts\">\n <error line=\"1\" column=\"14\" severity=\"warning\" message=\"Missing semicolon\" source=\"failure.tslint.semicolon\" />\n </file>\n </checkstyle>"]))),
|
||||
consumer: "machine",
|
||||
};
|
||||
return Formatter;
|
||||
}(abstractFormatter_1.AbstractFormatter));
|
||||
exports.Formatter = Formatter;
|
||||
var templateObject_1, templateObject_2;
|
||||
23
node_modules/tslint/lib/formatters/codeFrameFormatter.d.ts
generated
vendored
Normal file
23
node_modules/tslint/lib/formatters/codeFrameFormatter.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2013 Palantir Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { AbstractFormatter } from "../language/formatter/abstractFormatter";
|
||||
import { IFormatterMetadata } from "../language/formatter/formatter";
|
||||
import { RuleFailure } from "../language/rule/rule";
|
||||
export declare class Formatter extends AbstractFormatter {
|
||||
static metadata: IFormatterMetadata;
|
||||
format(failures: RuleFailure[]): string;
|
||||
}
|
||||
83
node_modules/tslint/lib/formatters/codeFrameFormatter.js
generated
vendored
Normal file
83
node_modules/tslint/lib/formatters/codeFrameFormatter.js
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2013 Palantir Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var code_frame_1 = require("@babel/code-frame");
|
||||
var chalk_1 = require("chalk");
|
||||
var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
|
||||
var Utils = require("../utils");
|
||||
var Formatter = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(Formatter, _super);
|
||||
function Formatter() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
/* tslint:enable:object-literal-sort-keys */
|
||||
Formatter.prototype.format = function (failures) {
|
||||
if (typeof failures[0] === "undefined") {
|
||||
return "\n";
|
||||
}
|
||||
failures = this.sortFailures(failures);
|
||||
var outputLines = [];
|
||||
var currentFile;
|
||||
for (var _i = 0, failures_1 = failures; _i < failures_1.length; _i++) {
|
||||
var failure = failures_1[_i];
|
||||
var fileName = failure.getFileName();
|
||||
// Output the name of each file once
|
||||
if (currentFile !== fileName) {
|
||||
outputLines.push("");
|
||||
outputLines.push(fileName);
|
||||
currentFile = fileName;
|
||||
}
|
||||
var failureString = failure.getFailure();
|
||||
failureString =
|
||||
failure.getRuleSeverity() === "warning"
|
||||
? chalk_1.default.yellow(failureString)
|
||||
: chalk_1.default.red(failureString);
|
||||
// Rule
|
||||
var ruleName = failure.getRuleName();
|
||||
ruleName = chalk_1.default.gray("(" + ruleName + ")");
|
||||
// Frame
|
||||
var _a = failure.getStartPosition().getLineAndCharacter(), column = _a.character, line = _a.line;
|
||||
var frame = code_frame_1.codeFrameColumns(failure.getRawLines(), { start: { line: line + 1, column: column } }, // babel-code-frame is 1 index
|
||||
{
|
||||
forceColor: chalk_1.default.enabled,
|
||||
highlightCode: true,
|
||||
});
|
||||
// Ouput
|
||||
outputLines.push(failureString + " " + ruleName);
|
||||
outputLines.push(frame);
|
||||
outputLines.push("");
|
||||
}
|
||||
// Removes initial blank line
|
||||
if (outputLines[0] === "") {
|
||||
outputLines.shift();
|
||||
}
|
||||
return outputLines.join("\n") + "\n";
|
||||
};
|
||||
/* tslint:disable:object-literal-sort-keys */
|
||||
Formatter.metadata = {
|
||||
formatterName: "codeFrame",
|
||||
description: "Framed formatter which creates a frame of error code.",
|
||||
descriptionDetails: Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Prints syntax highlighted code in a frame with a pointer to where\n exactly lint error is happening."], ["\n Prints syntax highlighted code in a frame with a pointer to where\n exactly lint error is happening."]))),
|
||||
sample: Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n src/components/Payment.tsx\n Parentheses are required around the parameters of an arrow function definition (arrow-parens)\n 21 | public componentDidMount() {\n 22 | this.input.focus();\n > 23 | loadStripe().then(Stripe => Stripe.pay());\n | ^\n 24 | }\n 25 |\n 26 | public render() {"], ["\n src/components/Payment.tsx\n Parentheses are required around the parameters of an arrow function definition (arrow-parens)\n 21 | public componentDidMount() {\n 22 | this.input.focus();\n > 23 | loadStripe().then(Stripe => Stripe.pay());\n | ^\n 24 | }\n 25 |\n 26 | public render() {"]))),
|
||||
consumer: "human",
|
||||
};
|
||||
return Formatter;
|
||||
}(abstractFormatter_1.AbstractFormatter));
|
||||
exports.Formatter = Formatter;
|
||||
var templateObject_1, templateObject_2;
|
||||
23
node_modules/tslint/lib/formatters/fileslistFormatter.d.ts
generated
vendored
Normal file
23
node_modules/tslint/lib/formatters/fileslistFormatter.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2013 Palantir Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { AbstractFormatter } from "../language/formatter/abstractFormatter";
|
||||
import { IFormatterMetadata } from "../language/formatter/formatter";
|
||||
import { RuleFailure } from "../language/rule/rule";
|
||||
export declare class Formatter extends AbstractFormatter {
|
||||
static metadata: IFormatterMetadata;
|
||||
format(failures: RuleFailure[]): string;
|
||||
}
|
||||
52
node_modules/tslint/lib/formatters/fileslistFormatter.js
generated
vendored
Normal file
52
node_modules/tslint/lib/formatters/fileslistFormatter.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2013 Palantir Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
|
||||
var Formatter = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(Formatter, _super);
|
||||
function Formatter() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
/* tslint:enable:object-literal-sort-keys */
|
||||
Formatter.prototype.format = function (failures) {
|
||||
if (failures.length === 0) {
|
||||
return "";
|
||||
}
|
||||
var files = [];
|
||||
var currentFile;
|
||||
for (var _i = 0, failures_1 = failures; _i < failures_1.length; _i++) {
|
||||
var failure = failures_1[_i];
|
||||
var fileName = failure.getFileName();
|
||||
if (fileName !== currentFile) {
|
||||
files.push(fileName);
|
||||
currentFile = fileName;
|
||||
}
|
||||
}
|
||||
return files.join("\n") + "\n";
|
||||
};
|
||||
/* tslint:disable:object-literal-sort-keys */
|
||||
Formatter.metadata = {
|
||||
formatterName: "filesList",
|
||||
description: "Lists files containing lint errors.",
|
||||
sample: "directory/myFile.ts",
|
||||
consumer: "machine",
|
||||
};
|
||||
return Formatter;
|
||||
}(abstractFormatter_1.AbstractFormatter));
|
||||
exports.Formatter = Formatter;
|
||||
25
node_modules/tslint/lib/formatters/index.d.ts
generated
vendored
Normal file
25
node_modules/tslint/lib/formatters/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2013 Palantir Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export { Formatter as JsonFormatter } from "./jsonFormatter";
|
||||
export { Formatter as PmdFormatter } from "./pmdFormatter";
|
||||
export { Formatter as ProseFormatter } from "./proseFormatter";
|
||||
export { Formatter as VerboseFormatter } from "./verboseFormatter";
|
||||
export { Formatter as StylishFormatter } from "./stylishFormatter";
|
||||
export { Formatter as FileslistFormatter } from "./fileslistFormatter";
|
||||
export { Formatter as CodeFrameFormatter } from "./codeFrameFormatter";
|
||||
export { Formatter as TapFormatter } from "./tapFormatter";
|
||||
export { Formatter as JUnitFormatter } from "./junitFormatter";
|
||||
36
node_modules/tslint/lib/formatters/index.js
generated
vendored
Normal file
36
node_modules/tslint/lib/formatters/index.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2013 Palantir Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var jsonFormatter_1 = require("./jsonFormatter");
|
||||
exports.JsonFormatter = jsonFormatter_1.Formatter;
|
||||
var pmdFormatter_1 = require("./pmdFormatter");
|
||||
exports.PmdFormatter = pmdFormatter_1.Formatter;
|
||||
var proseFormatter_1 = require("./proseFormatter");
|
||||
exports.ProseFormatter = proseFormatter_1.Formatter;
|
||||
var verboseFormatter_1 = require("./verboseFormatter");
|
||||
exports.VerboseFormatter = verboseFormatter_1.Formatter;
|
||||
var stylishFormatter_1 = require("./stylishFormatter");
|
||||
exports.StylishFormatter = stylishFormatter_1.Formatter;
|
||||
var fileslistFormatter_1 = require("./fileslistFormatter");
|
||||
exports.FileslistFormatter = fileslistFormatter_1.Formatter;
|
||||
var codeFrameFormatter_1 = require("./codeFrameFormatter");
|
||||
exports.CodeFrameFormatter = codeFrameFormatter_1.Formatter;
|
||||
var tapFormatter_1 = require("./tapFormatter");
|
||||
exports.TapFormatter = tapFormatter_1.Formatter;
|
||||
var junitFormatter_1 = require("./junitFormatter");
|
||||
exports.JUnitFormatter = junitFormatter_1.Formatter;
|
||||
23
node_modules/tslint/lib/formatters/jsonFormatter.d.ts
generated
vendored
Normal file
23
node_modules/tslint/lib/formatters/jsonFormatter.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2013 Palantir Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { AbstractFormatter } from "../language/formatter/abstractFormatter";
|
||||
import { IFormatterMetadata } from "../language/formatter/formatter";
|
||||
import { RuleFailure } from "../language/rule/rule";
|
||||
export declare class Formatter extends AbstractFormatter {
|
||||
static metadata: IFormatterMetadata;
|
||||
format(failures: RuleFailure[]): string;
|
||||
}
|
||||
42
node_modules/tslint/lib/formatters/jsonFormatter.js
generated
vendored
Normal file
42
node_modules/tslint/lib/formatters/jsonFormatter.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2013 Palantir Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
|
||||
var Utils = require("../utils");
|
||||
var Formatter = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(Formatter, _super);
|
||||
function Formatter() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
/* tslint:enable:object-literal-sort-keys */
|
||||
Formatter.prototype.format = function (failures) {
|
||||
var failuresJSON = failures.map(function (failure) { return failure.toJson(); });
|
||||
return JSON.stringify(failuresJSON);
|
||||
};
|
||||
/* tslint:disable:object-literal-sort-keys */
|
||||
Formatter.metadata = {
|
||||
formatterName: "json",
|
||||
description: "Formats errors as simple JSON.",
|
||||
sample: Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n [\n {\n \"endPosition\": {\n \"character\": 13,\n \"line\": 0,\n \"position\": 13\n },\n \"failure\": \"Missing semicolon\",\n \"fix\": {\n \"innerStart\": 13,\n \"innerLength\": 0,\n \"innerText\": \";\"\n },\n \"name\": \"myFile.ts\",\n \"ruleName\": \"semicolon\",\n \"startPosition\": {\n \"character\": 13,\n \"line\": 0,\n \"position\": 13\n }\n }\n ]"], ["\n [\n {\n \"endPosition\": {\n \"character\": 13,\n \"line\": 0,\n \"position\": 13\n },\n \"failure\": \"Missing semicolon\",\n \"fix\": {\n \"innerStart\": 13,\n \"innerLength\": 0,\n \"innerText\": \";\"\n },\n \"name\": \"myFile.ts\",\n \"ruleName\": \"semicolon\",\n \"startPosition\": {\n \"character\": 13,\n \"line\": 0,\n \"position\": 13\n }\n }\n ]"]))),
|
||||
consumer: "machine",
|
||||
};
|
||||
return Formatter;
|
||||
}(abstractFormatter_1.AbstractFormatter));
|
||||
exports.Formatter = Formatter;
|
||||
var templateObject_1;
|
||||
24
node_modules/tslint/lib/formatters/junitFormatter.d.ts
generated
vendored
Normal file
24
node_modules/tslint/lib/formatters/junitFormatter.d.ts
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2018 Palantir Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { AbstractFormatter } from "../language/formatter/abstractFormatter";
|
||||
import { IFormatterMetadata } from "../language/formatter/formatter";
|
||||
import { RuleFailure } from "../language/rule/rule";
|
||||
export declare class Formatter extends AbstractFormatter {
|
||||
static metadata: IFormatterMetadata;
|
||||
format(failures: RuleFailure[], _fixes?: RuleFailure[], fileNames?: string[]): string;
|
||||
private escapeXml;
|
||||
}
|
||||
93
node_modules/tslint/lib/formatters/junitFormatter.js
generated
vendored
Normal file
93
node_modules/tslint/lib/formatters/junitFormatter.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2018 Palantir Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
|
||||
var Utils = require("../utils");
|
||||
var Formatter = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(Formatter, _super);
|
||||
function Formatter() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
/* tslint:enable:object-literal-sort-keys */
|
||||
Formatter.prototype.format = function (failures, _fixes, fileNames) {
|
||||
var output = '<?xml version="1.0" encoding="utf-8"?><testsuites package="tslint">';
|
||||
var failureFileNames = new Set(failures.map(function (f) { return f.getFileName(); }).slice());
|
||||
if (failures.length !== 0) {
|
||||
var failuresSorted = failures.sort(function (a, b) {
|
||||
return a.getFileName().localeCompare(b.getFileName());
|
||||
});
|
||||
var previousFilename = null;
|
||||
for (var _i = 0, failuresSorted_1 = failuresSorted; _i < failuresSorted_1.length; _i++) {
|
||||
var failure = failuresSorted_1[_i];
|
||||
var lineAndCharacter = failure.getStartPosition().getLineAndCharacter();
|
||||
var message = this.escapeXml(failure.getFailure());
|
||||
var rule = this.escapeXml(failure.getRuleName());
|
||||
var severity = failure.getRuleSeverity();
|
||||
if (failure.getFileName() !== previousFilename) {
|
||||
if (previousFilename !== null) {
|
||||
output += "</testsuite>";
|
||||
}
|
||||
previousFilename = failure.getFileName();
|
||||
output += "<testsuite name=\"" + this.escapeXml(failure.getFileName()) + "\">";
|
||||
}
|
||||
output += "<testcase name=\"" + rule + "\" ";
|
||||
output += "classname=\"" + this.escapeXml(failure.getFileName()) + "\">";
|
||||
output += "<failure type=\"" + severity + "\">" + message + " ";
|
||||
output += "Line " + (lineAndCharacter.line + 1) + ", ";
|
||||
output += "Column " + (lineAndCharacter.character + 1);
|
||||
output += "</failure>";
|
||||
output += "</testcase>";
|
||||
}
|
||||
if (previousFilename !== null) {
|
||||
output += "</testsuite>";
|
||||
}
|
||||
}
|
||||
if (fileNames !== undefined && fileNames.length !== 0) {
|
||||
// Filter out files which have had a failure associated with them.
|
||||
var filteredFileNames = fileNames.filter(function (fileName) { return !failureFileNames.has(fileName); });
|
||||
for (var _a = 0, filteredFileNames_1 = filteredFileNames; _a < filteredFileNames_1.length; _a++) {
|
||||
var fileName = filteredFileNames_1[_a];
|
||||
output += "<testsuite name=\"" + this.escapeXml(fileName) + "\" errors=\"0\">";
|
||||
output += "<testcase name=\"" + this.escapeXml(fileName) + "\" />";
|
||||
output += "</testsuite>";
|
||||
}
|
||||
}
|
||||
output += "</testsuites>";
|
||||
return output;
|
||||
};
|
||||
Formatter.prototype.escapeXml = function (str) {
|
||||
return str
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
.replace(/'/g, "'")
|
||||
.replace(/"/g, """);
|
||||
};
|
||||
/* tslint:disable:object-literal-sort-keys */
|
||||
Formatter.metadata = {
|
||||
formatterName: "junit",
|
||||
description: "Formats errors as though they were JUnit output.",
|
||||
descriptionDetails: Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Imitates the JUnit XML Output"], ["\n Imitates the JUnit XML Output"]))),
|
||||
sample: Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n <?xml version=\"1.0\" encoding=\"utf-8\"?>\n <testsuites package=\"tslint\">\n <testsuite name=\"myFile.ts\">\n <testcase name=\"semicolon\" classname=\"myFile.ts\">\n <failure type=\"warning\">Missing semicolon Line 1, Column 14</failure>\n </testcase>\n </testsuite>\n </testsuites>\n "], ["\n <?xml version=\"1.0\" encoding=\"utf-8\"?>\n <testsuites package=\"tslint\">\n <testsuite name=\"myFile.ts\">\n <testcase name=\"semicolon\" classname=\"myFile.ts\">\n <failure type=\"warning\">Missing semicolon Line 1, Column 14</failure>\n </testcase>\n </testsuite>\n </testsuites>\n "]))),
|
||||
consumer: "machine",
|
||||
};
|
||||
return Formatter;
|
||||
}(abstractFormatter_1.AbstractFormatter));
|
||||
exports.Formatter = Formatter;
|
||||
var templateObject_1, templateObject_2;
|
||||
23
node_modules/tslint/lib/formatters/msbuildFormatter.d.ts
generated
vendored
Normal file
23
node_modules/tslint/lib/formatters/msbuildFormatter.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2018 Palantir Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { AbstractFormatter } from "../language/formatter/abstractFormatter";
|
||||
import { IFormatterMetadata } from "../language/formatter/formatter";
|
||||
import { RuleFailure } from "../language/rule/rule";
|
||||
export declare class Formatter extends AbstractFormatter {
|
||||
static metadata: IFormatterMetadata;
|
||||
format(failures: RuleFailure[]): string;
|
||||
}
|
||||
52
node_modules/tslint/lib/formatters/msbuildFormatter.js
generated
vendored
Normal file
52
node_modules/tslint/lib/formatters/msbuildFormatter.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2018 Palantir Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var path = require("path");
|
||||
var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
|
||||
var utils_1 = require("../utils");
|
||||
var Formatter = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(Formatter, _super);
|
||||
function Formatter() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
/* tslint:enable:object-literal-sort-keys */
|
||||
Formatter.prototype.format = function (failures) {
|
||||
var outputLines = failures.map(function (failure) {
|
||||
var fileName = path.normalize(failure.getFileName());
|
||||
var failureString = failure.getFailure();
|
||||
var camelizedRule = utils_1.camelize(failure.getRuleName());
|
||||
var lineAndCharacter = failure.getStartPosition().getLineAndCharacter();
|
||||
var positionTuple = "(" + (lineAndCharacter.line + 1) + "," + (lineAndCharacter.character +
|
||||
1) + ")";
|
||||
var severity = failure.getRuleSeverity();
|
||||
return "" + fileName + positionTuple + ": " + severity + " " + camelizedRule + ": " + failureString;
|
||||
});
|
||||
return outputLines.join("\n") + "\n";
|
||||
};
|
||||
/* tslint:disable:object-literal-sort-keys */
|
||||
Formatter.metadata = {
|
||||
formatterName: "msbuild",
|
||||
description: "Formats errors for consumption by msbuild.",
|
||||
descriptionDetails: "The output is compatible with both msbuild and Visual Studio.",
|
||||
sample: "myFile.ts(1,14): warning: Missing semicolon",
|
||||
consumer: "machine",
|
||||
};
|
||||
return Formatter;
|
||||
}(abstractFormatter_1.AbstractFormatter));
|
||||
exports.Formatter = Formatter;
|
||||
23
node_modules/tslint/lib/formatters/pmdFormatter.d.ts
generated
vendored
Normal file
23
node_modules/tslint/lib/formatters/pmdFormatter.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2013 Palantir Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { AbstractFormatter } from "../language/formatter/abstractFormatter";
|
||||
import { IFormatterMetadata } from "../language/formatter/formatter";
|
||||
import { RuleFailure } from "../language/rule/rule";
|
||||
export declare class Formatter extends AbstractFormatter {
|
||||
static metadata: IFormatterMetadata;
|
||||
format(failures: RuleFailure[]): string;
|
||||
}
|
||||
61
node_modules/tslint/lib/formatters/pmdFormatter.js
generated
vendored
Normal file
61
node_modules/tslint/lib/formatters/pmdFormatter.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2013 Palantir Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
|
||||
var Utils = require("../utils");
|
||||
var Formatter = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(Formatter, _super);
|
||||
function Formatter() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
/* tslint:enable:object-literal-sort-keys */
|
||||
Formatter.prototype.format = function (failures) {
|
||||
var output = '<pmd version="tslint">';
|
||||
for (var _i = 0, failures_1 = failures; _i < failures_1.length; _i++) {
|
||||
var failure = failures_1[_i];
|
||||
var failureString = failure
|
||||
.getFailure()
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
.replace(/'/g, "'")
|
||||
.replace(/"/g, """);
|
||||
var lineAndCharacter = failure.getStartPosition().getLineAndCharacter();
|
||||
var priority = failure.getRuleSeverity() === "warning" ? 4 : 3;
|
||||
output += "<file name=\"" + failure.getFileName();
|
||||
output += "\"><violation begincolumn=\"" + (lineAndCharacter.character + 1);
|
||||
output += "\" beginline=\"" + (lineAndCharacter.line + 1);
|
||||
output += "\" priority=\"" + priority + "\"";
|
||||
output += " rule=\"" + failureString + "\"></violation></file>";
|
||||
}
|
||||
output += "</pmd>";
|
||||
return output;
|
||||
};
|
||||
/* tslint:disable:object-literal-sort-keys */
|
||||
Formatter.metadata = {
|
||||
formatterName: "pmd",
|
||||
description: "Formats errors as though they were PMD output.",
|
||||
descriptionDetails: "Imitates the XML output from PMD. All errors have a priority of 1.",
|
||||
sample: Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n <pmd version=\"tslint\">\n <file name=\"myFile.ts\">\n <violation begincolumn=\"14\" beginline=\"1\" priority=\"3\" rule=\"Missing semicolon\"></violation>\n </file>\n </pmd>"], ["\n <pmd version=\"tslint\">\n <file name=\"myFile.ts\">\n <violation begincolumn=\"14\" beginline=\"1\" priority=\"3\" rule=\"Missing semicolon\"></violation>\n </file>\n </pmd>"]))),
|
||||
consumer: "machine",
|
||||
};
|
||||
return Formatter;
|
||||
}(abstractFormatter_1.AbstractFormatter));
|
||||
exports.Formatter = Formatter;
|
||||
var templateObject_1;
|
||||
23
node_modules/tslint/lib/formatters/proseFormatter.d.ts
generated
vendored
Normal file
23
node_modules/tslint/lib/formatters/proseFormatter.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2013 Palantir Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { AbstractFormatter } from "../language/formatter/abstractFormatter";
|
||||
import { IFormatterMetadata } from "../language/formatter/formatter";
|
||||
import { RuleFailure } from "../language/rule/rule";
|
||||
export declare class Formatter extends AbstractFormatter {
|
||||
static metadata: IFormatterMetadata;
|
||||
format(failures: RuleFailure[], fixes?: RuleFailure[]): string;
|
||||
}
|
||||
65
node_modules/tslint/lib/formatters/proseFormatter.js
generated
vendored
Normal file
65
node_modules/tslint/lib/formatters/proseFormatter.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2013 Palantir Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
|
||||
var Formatter = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(Formatter, _super);
|
||||
function Formatter() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
/* tslint:enable:object-literal-sort-keys */
|
||||
Formatter.prototype.format = function (failures, fixes) {
|
||||
if (failures.length === 0 && (fixes === undefined || fixes.length === 0)) {
|
||||
return "\n";
|
||||
}
|
||||
failures = this.sortFailures(failures);
|
||||
var fixLines = [];
|
||||
if (fixes !== undefined) {
|
||||
var perFileFixes = new Map();
|
||||
for (var _i = 0, fixes_1 = fixes; _i < fixes_1.length; _i++) {
|
||||
var fix = fixes_1[_i];
|
||||
var prevFixes = perFileFixes.get(fix.getFileName());
|
||||
perFileFixes.set(fix.getFileName(), (prevFixes !== undefined ? prevFixes : 0) + 1);
|
||||
}
|
||||
perFileFixes.forEach(function (fixCount, fixedFile) {
|
||||
fixLines.push("Fixed " + fixCount + " error(s) in " + fixedFile);
|
||||
});
|
||||
fixLines.push(""); // add a blank line between fixes and failures
|
||||
}
|
||||
var errorLines = failures.map(function (failure) {
|
||||
var fileName = failure.getFileName();
|
||||
var failureString = failure.getFailure();
|
||||
var lineAndCharacter = failure.getStartPosition().getLineAndCharacter();
|
||||
var positionTuple = lineAndCharacter.line + 1 + ":" + (lineAndCharacter.character + 1);
|
||||
return failure
|
||||
.getRuleSeverity()
|
||||
.toUpperCase() + ": " + fileName + ":" + positionTuple + " - " + failureString;
|
||||
});
|
||||
return fixLines.concat(errorLines).join("\n") + "\n";
|
||||
};
|
||||
/* tslint:disable:object-literal-sort-keys */
|
||||
Formatter.metadata = {
|
||||
formatterName: "prose",
|
||||
description: "The default formatter which outputs simple human-readable messages.",
|
||||
sample: "ERROR: myFile.ts:1:14 - Missing semicolon",
|
||||
consumer: "human",
|
||||
};
|
||||
return Formatter;
|
||||
}(abstractFormatter_1.AbstractFormatter));
|
||||
exports.Formatter = Formatter;
|
||||
27
node_modules/tslint/lib/formatters/stylishFormatter.d.ts
generated
vendored
Normal file
27
node_modules/tslint/lib/formatters/stylishFormatter.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2013 Palantir Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { AbstractFormatter } from "../language/formatter/abstractFormatter";
|
||||
import { IFormatterMetadata } from "../language/formatter/formatter";
|
||||
import { RuleFailure } from "../language/rule/rule";
|
||||
export declare class Formatter extends AbstractFormatter {
|
||||
static metadata: IFormatterMetadata;
|
||||
format(failures: RuleFailure[]): string;
|
||||
private mapToMessages;
|
||||
private pad;
|
||||
private getPositionMaxSize;
|
||||
private getRuleMaxSize;
|
||||
}
|
||||
114
node_modules/tslint/lib/formatters/stylishFormatter.js
generated
vendored
Normal file
114
node_modules/tslint/lib/formatters/stylishFormatter.js
generated
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2013 Palantir Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var chalk_1 = require("chalk");
|
||||
var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
|
||||
var Utils = require("../utils");
|
||||
var Formatter = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(Formatter, _super);
|
||||
function Formatter() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
/* tslint:enable:object-literal-sort-keys */
|
||||
Formatter.prototype.format = function (failures) {
|
||||
failures = this.sortFailures(failures);
|
||||
var outputLines = this.mapToMessages(failures);
|
||||
// Removes initial blank line
|
||||
if (outputLines[0] === "") {
|
||||
outputLines.shift();
|
||||
}
|
||||
return outputLines.join("\n") + "\n";
|
||||
};
|
||||
Formatter.prototype.mapToMessages = function (failures) {
|
||||
if (failures.length === 0) {
|
||||
return [];
|
||||
}
|
||||
var outputLines = [];
|
||||
var positionMaxSize = this.getPositionMaxSize(failures);
|
||||
var ruleMaxSize = this.getRuleMaxSize(failures);
|
||||
var currentFile;
|
||||
for (var _i = 0, failures_1 = failures; _i < failures_1.length; _i++) {
|
||||
var failure = failures_1[_i];
|
||||
var fileName = failure.getFileName();
|
||||
var lineAndCharacter = failure.getStartPosition().getLineAndCharacter();
|
||||
var positionTuple = lineAndCharacter.line + 1 + ":" + (lineAndCharacter.character + 1);
|
||||
// Output the name of each file once
|
||||
if (currentFile !== fileName) {
|
||||
outputLines.push("");
|
||||
outputLines.push("" + fileName + chalk_1.default.hidden(":" + positionTuple));
|
||||
currentFile = fileName;
|
||||
}
|
||||
var failureString = failure.getFailure();
|
||||
failureString = chalk_1.default.yellow(failureString);
|
||||
// Rule
|
||||
var ruleName = failure.getRuleName();
|
||||
ruleName = this.pad(ruleName, ruleMaxSize);
|
||||
ruleName = chalk_1.default.grey(ruleName);
|
||||
// Lines
|
||||
positionTuple = this.pad(positionTuple, positionMaxSize);
|
||||
positionTuple =
|
||||
failure.getRuleSeverity() === "warning"
|
||||
? chalk_1.default.blue(failure.getRuleSeverity().toUpperCase() + ": " + positionTuple)
|
||||
: chalk_1.default.red(failure.getRuleSeverity().toUpperCase() + ": " + positionTuple);
|
||||
// Output
|
||||
var output = positionTuple + " " + ruleName + " " + failureString;
|
||||
outputLines.push(output);
|
||||
}
|
||||
return outputLines;
|
||||
};
|
||||
Formatter.prototype.pad = function (str, len) {
|
||||
var padder = Array(len + 1).join(" ");
|
||||
return (str + padder).substring(0, padder.length);
|
||||
};
|
||||
Formatter.prototype.getPositionMaxSize = function (failures) {
|
||||
var positionMaxSize = 0;
|
||||
for (var _i = 0, failures_2 = failures; _i < failures_2.length; _i++) {
|
||||
var failure = failures_2[_i];
|
||||
var lineAndCharacter = failure.getStartPosition().getLineAndCharacter();
|
||||
var positionSize = (lineAndCharacter.line + 1 + ":" + (lineAndCharacter.character + 1))
|
||||
.length;
|
||||
if (positionSize > positionMaxSize) {
|
||||
positionMaxSize = positionSize;
|
||||
}
|
||||
}
|
||||
return positionMaxSize;
|
||||
};
|
||||
Formatter.prototype.getRuleMaxSize = function (failures) {
|
||||
var ruleMaxSize = 0;
|
||||
for (var _i = 0, failures_3 = failures; _i < failures_3.length; _i++) {
|
||||
var failure = failures_3[_i];
|
||||
var ruleSize = failure.getRuleName().length;
|
||||
if (ruleSize > ruleMaxSize) {
|
||||
ruleMaxSize = ruleSize;
|
||||
}
|
||||
}
|
||||
return ruleMaxSize;
|
||||
};
|
||||
/* tslint:disable:object-literal-sort-keys */
|
||||
Formatter.metadata = {
|
||||
formatterName: "stylish",
|
||||
description: "Human-readable formatter which creates stylish messages.",
|
||||
descriptionDetails: Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n The output matches what is produced by ESLint's stylish formatter.\n Its readability is enhanced through spacing and colouring."], ["\n The output matches what is produced by ESLint's stylish formatter.\n Its readability is enhanced through spacing and colouring."]))),
|
||||
sample: Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n myFile.ts\n Error: 1:14 semicolon Missing semicolon"], ["\n myFile.ts\n Error: 1:14 semicolon Missing semicolon"]))),
|
||||
consumer: "human",
|
||||
};
|
||||
return Formatter;
|
||||
}(abstractFormatter_1.AbstractFormatter));
|
||||
exports.Formatter = Formatter;
|
||||
var templateObject_1, templateObject_2;
|
||||
24
node_modules/tslint/lib/formatters/tapFormatter.d.ts
generated
vendored
Normal file
24
node_modules/tslint/lib/formatters/tapFormatter.d.ts
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Palantir Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { AbstractFormatter } from "../language/formatter/abstractFormatter";
|
||||
import { IFormatterMetadata } from "../language/formatter/formatter";
|
||||
import { RuleFailure } from "../language/rule/rule";
|
||||
export declare class Formatter extends AbstractFormatter {
|
||||
static metadata: IFormatterMetadata;
|
||||
format(failures: RuleFailure[]): string;
|
||||
private mapToMessages;
|
||||
}
|
||||
59
node_modules/tslint/lib/formatters/tapFormatter.js
generated
vendored
Normal file
59
node_modules/tslint/lib/formatters/tapFormatter.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Palantir Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
|
||||
var Utils = require("../utils");
|
||||
var Formatter = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(Formatter, _super);
|
||||
function Formatter() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
/* tslint:enable:object-literal-sort-keys */
|
||||
Formatter.prototype.format = function (failures) {
|
||||
var output = ["TAP version 13"];
|
||||
output =
|
||||
failures.length === 0
|
||||
? output.concat(["1..0 # SKIP No failures"])
|
||||
: output.concat(["1.." + failures.length]).concat(this.mapToMessages(failures));
|
||||
return output.join("\n") + "\n";
|
||||
};
|
||||
Formatter.prototype.mapToMessages = function (failures) {
|
||||
return failures.map(function (failure, i) {
|
||||
var fileName = failure.getFileName();
|
||||
var failureString = failure.getFailure();
|
||||
var ruleName = failure.getRuleName();
|
||||
var failureMessage = failure.getFailure();
|
||||
var failureSeverity = failure.getRuleSeverity();
|
||||
var failureRaw = failure.getRawLines();
|
||||
var lineAndCharacter = failure.getStartPosition().getLineAndCharacter();
|
||||
return Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n not ok ", " - ", "\n ---\n message : ", "\n severity: ", "\n data:\n ruleName: ", "\n fileName: ", "\n line: ", "\n character: ", "\n failureString: ", "\n rawLines: ", "\n ..."], ["\n not ok ", " - ", "\n ---\n message : ", "\n severity: ", "\n data:\n ruleName: ", "\n fileName: ", "\n line: ", "\n character: ", "\n failureString: ", "\n rawLines: ", "\n ..."])), String(i + 1), failureMessage, failureMessage, failureSeverity, ruleName, fileName, String(lineAndCharacter.line), String(lineAndCharacter.character), failureString, failureRaw);
|
||||
});
|
||||
};
|
||||
/* tslint:disable:object-literal-sort-keys */
|
||||
Formatter.metadata = {
|
||||
formatterName: "tap",
|
||||
description: "Formats output as TAP stream.",
|
||||
descriptionDetails: "Provides error messages output in TAP13 format which can be consumed by any TAP formatter.",
|
||||
sample: Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n TAP version 13\n 1..1\n not ok 1 - Some error\n ---\n message: Variable has any type\n severity: error\n data:\n ruleName: no-any\n fileName: test-file.ts\n line: 10\n character: 10\n failureString: Some error\n rawLines: Some raw output\n ..."], ["\n TAP version 13\n 1..1\n not ok 1 - Some error\n ---\n message: Variable has any type\n severity: error\n data:\n ruleName: no-any\n fileName: test-file.ts\n line: 10\n character: 10\n failureString: Some error\n rawLines: Some raw output\n ..."]))),
|
||||
consumer: "machine",
|
||||
};
|
||||
return Formatter;
|
||||
}(abstractFormatter_1.AbstractFormatter));
|
||||
exports.Formatter = Formatter;
|
||||
var templateObject_1, templateObject_2;
|
||||
24
node_modules/tslint/lib/formatters/verboseFormatter.d.ts
generated
vendored
Normal file
24
node_modules/tslint/lib/formatters/verboseFormatter.d.ts
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2013 Palantir Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { AbstractFormatter } from "../language/formatter/abstractFormatter";
|
||||
import { IFormatterMetadata } from "../language/formatter/formatter";
|
||||
import { RuleFailure } from "../language/rule/rule";
|
||||
export declare class Formatter extends AbstractFormatter {
|
||||
static metadata: IFormatterMetadata;
|
||||
format(failures: RuleFailure[]): string;
|
||||
private mapToMessages;
|
||||
}
|
||||
54
node_modules/tslint/lib/formatters/verboseFormatter.js
generated
vendored
Normal file
54
node_modules/tslint/lib/formatters/verboseFormatter.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2013 Palantir Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
|
||||
var Formatter = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(Formatter, _super);
|
||||
function Formatter() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
/* tslint:enable:object-literal-sort-keys */
|
||||
Formatter.prototype.format = function (failures) {
|
||||
failures = this.sortFailures(failures);
|
||||
return this.mapToMessages(failures).join("\n") + "\n";
|
||||
};
|
||||
Formatter.prototype.mapToMessages = function (failures) {
|
||||
return failures.map(function (failure) {
|
||||
var fileName = failure.getFileName();
|
||||
var failureString = failure.getFailure();
|
||||
var ruleName = failure.getRuleName();
|
||||
var lineAndCharacter = failure.getStartPosition().getLineAndCharacter();
|
||||
var positionTuple = "[" + (lineAndCharacter.line + 1) + ", " + (lineAndCharacter.character +
|
||||
1) + "]";
|
||||
return failure
|
||||
.getRuleSeverity()
|
||||
.toUpperCase() + ": (" + ruleName + ") " + fileName + positionTuple + ": " + failureString;
|
||||
});
|
||||
};
|
||||
/* tslint:disable:object-literal-sort-keys */
|
||||
Formatter.metadata = {
|
||||
formatterName: "verbose",
|
||||
description: "The human-readable formatter which includes the rule name in messages.",
|
||||
descriptionDetails: "The output is the same as the prose formatter with the rule name included",
|
||||
sample: "ERROR: (semicolon) myFile.ts[1, 14]: Missing semicolon",
|
||||
consumer: "human",
|
||||
};
|
||||
return Formatter;
|
||||
}(abstractFormatter_1.AbstractFormatter));
|
||||
exports.Formatter = Formatter;
|
||||
23
node_modules/tslint/lib/formatters/vsoFormatter.d.ts
generated
vendored
Normal file
23
node_modules/tslint/lib/formatters/vsoFormatter.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2018 Palantir Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { AbstractFormatter } from "../language/formatter/abstractFormatter";
|
||||
import { IFormatterMetadata } from "../language/formatter/formatter";
|
||||
import { RuleFailure } from "../language/rule/rule";
|
||||
export declare class Formatter extends AbstractFormatter {
|
||||
static metadata: IFormatterMetadata;
|
||||
format(failures: RuleFailure[]): string;
|
||||
}
|
||||
52
node_modules/tslint/lib/formatters/vsoFormatter.js
generated
vendored
Normal file
52
node_modules/tslint/lib/formatters/vsoFormatter.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2018 Palantir Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var abstractFormatter_1 = require("../language/formatter/abstractFormatter");
|
||||
var Utils = require("../utils");
|
||||
var Formatter = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(Formatter, _super);
|
||||
function Formatter() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
/* tslint:enable:object-literal-sort-keys */
|
||||
Formatter.prototype.format = function (failures) {
|
||||
var outputLines = failures.map(function (failure) {
|
||||
var fileName = failure.getFileName();
|
||||
var failureString = failure.getFailure();
|
||||
var lineAndCharacter = failure.getStartPosition().getLineAndCharacter();
|
||||
var line = lineAndCharacter.line + 1;
|
||||
var character = lineAndCharacter.character + 1;
|
||||
var code = failure.getRuleName();
|
||||
var properties = "sourcepath=" + fileName + ";linenumber=" + line + ";columnnumber=" + character + ";code=" + code + ";";
|
||||
return "##vso[task.logissue type=warning;" + properties + "]" + failureString;
|
||||
});
|
||||
return outputLines.join("\n") + "\n";
|
||||
};
|
||||
/* tslint:disable:object-literal-sort-keys */
|
||||
Formatter.metadata = {
|
||||
formatterName: "vso",
|
||||
description: "Formats output as VSO/TFS logging commands.",
|
||||
descriptionDetails: Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Integrates with Azure DevOps (previously known as Visual Studio Online, Team Foundation Server,\n or Visual Studio Team Services) by outputting errors as 'warning' logging commands."], ["\n Integrates with Azure DevOps (previously known as Visual Studio Online, Team Foundation Server,\n or Visual Studio Team Services) by outputting errors as 'warning' logging commands."]))),
|
||||
sample: "##vso[task.logissue type=warning;sourcepath=myFile.ts;linenumber=1;columnnumber=14;code=semicolon;]Missing semicolon",
|
||||
consumer: "machine",
|
||||
};
|
||||
return Formatter;
|
||||
}(abstractFormatter_1.AbstractFormatter));
|
||||
exports.Formatter = Formatter;
|
||||
var templateObject_1;
|
||||
Reference in New Issue
Block a user