diff options
Diffstat (limited to 'node_modules/tslint/lib/formatters')
24 files changed, 1021 insertions, 0 deletions
diff --git a/node_modules/tslint/lib/formatters/checkstyleFormatter.d.ts b/node_modules/tslint/lib/formatters/checkstyleFormatter.d.ts new file mode 100644 index 000000000..8c6b27056 --- /dev/null +++ b/node_modules/tslint/lib/formatters/checkstyleFormatter.d.ts @@ -0,0 +1,24 @@ +/** + * @license + * Copyright 2016 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 escapeXml(str); +} diff --git a/node_modules/tslint/lib/formatters/checkstyleFormatter.js b/node_modules/tslint/lib/formatters/checkstyleFormatter.js new file mode 100644 index 000000000..c3345f774 --- /dev/null +++ b/node_modules/tslint/lib/formatters/checkstyleFormatter.js @@ -0,0 +1,78 @@ +"use strict"; +/** + * @license + * Copyright 2016 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 = (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 = '<?xml version="1.0" encoding="utf-8"?><checkstyle version="4.3">'; + 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 severity = failure.getRuleSeverity(); + if (failure.getFileName() !== previousFilename) { + if (previousFilename !== null) { + output += "</file>"; + } + previousFilename = failure.getFileName(); + output += "<file name=\"" + this.escapeXml(failure.getFileName()) + "\">"; + } + output += "<error line=\"" + (failure.getStartPosition().getLineAndCharacter().line + 1) + "\" "; + output += "column=\"" + (failure.getStartPosition().getLineAndCharacter().character + 1) + "\" "; + output += "severity=\"" + severity + "\" "; + output += "message=\"" + this.escapeXml(failure.getFailure()) + "\" "; + // checkstyle parser wants "source" to have structure like <anything>dot<category>dot<type> + output += "source=\"failure.tslint." + this.escapeXml(failure.getRuleName()) + "\" />"; + } + if (previousFilename !== null) { + output += "</file>"; + } + } + output += "</checkstyle>"; + return output; + }; + Formatter.prototype.escapeXml = function (str) { + return str + .replace(/&/g, "&") + .replace(/</g, "<") + .replace(/>/g, ">") + .replace(/'/g, "'") + .replace(/"/g, """); + }; + return Formatter; +}(abstractFormatter_1.AbstractFormatter)); +/* tslint:disable:object-literal-sort-keys */ +Formatter.metadata = { + formatterName: "checkstyle", + description: "Formats errors as through they were Checkstyle output.", + descriptionDetails: (_a = ["\n Imitates the XMLLogger from Checkstyle 4.3. All failures have the 'warning' severity."], _a.raw = ["\n Imitates the XMLLogger from Checkstyle 4.3. All failures have the 'warning' severity."], Utils.dedent(_a)), + sample: (_b = ["\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>"], _b.raw = ["\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>"], Utils.dedent(_b)), + consumer: "machine", +}; +exports.Formatter = Formatter; +var _a, _b; diff --git a/node_modules/tslint/lib/formatters/codeFrameFormatter.d.ts b/node_modules/tslint/lib/formatters/codeFrameFormatter.d.ts new file mode 100644 index 000000000..af3160a3f --- /dev/null +++ b/node_modules/tslint/lib/formatters/codeFrameFormatter.d.ts @@ -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; +} diff --git a/node_modules/tslint/lib/formatters/codeFrameFormatter.js b/node_modules/tslint/lib/formatters/codeFrameFormatter.js new file mode 100644 index 000000000..b828bf58e --- /dev/null +++ b/node_modules/tslint/lib/formatters/codeFrameFormatter.js @@ -0,0 +1,79 @@ +"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 codeFrame = require("babel-code-frame"); +var colors = require("colors"); +var Utils = require("../utils"); +var Formatter = (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"; + } + 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 = colors.red(failureString); + // Rule + var ruleName = failure.getRuleName(); + ruleName = colors.gray("(" + ruleName + ")"); + // Frame + var lineAndCharacter = failure.getStartPosition().getLineAndCharacter(); + var frame = codeFrame(failure.getRawLines(), lineAndCharacter.line + 1, // babel-code-frame is 1 index + lineAndCharacter.character, { + forceColor: colors.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"; + }; + return Formatter; +}(abstractFormatter_1.AbstractFormatter)); +/* tslint:disable:object-literal-sort-keys */ +Formatter.metadata = { + formatterName: "codeFrame", + description: "Framed formatter which creates a frame of error code.", + descriptionDetails: (_a = ["\n Prints syntax highlighted code in a frame with a pointer to where\n exactly lint error is happening."], _a.raw = ["\n Prints syntax highlighted code in a frame with a pointer to where\n exactly lint error is happening."], Utils.dedent(_a)), + sample: (_b = ["\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() {"], _b.raw = ["\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() {"], Utils.dedent(_b)), + consumer: "human", +}; +exports.Formatter = Formatter; +var _a, _b; diff --git a/node_modules/tslint/lib/formatters/fileslistFormatter.d.ts b/node_modules/tslint/lib/formatters/fileslistFormatter.d.ts new file mode 100644 index 000000000..af3160a3f --- /dev/null +++ b/node_modules/tslint/lib/formatters/fileslistFormatter.d.ts @@ -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; +} diff --git a/node_modules/tslint/lib/formatters/fileslistFormatter.js b/node_modules/tslint/lib/formatters/fileslistFormatter.js new file mode 100644 index 000000000..23bda6bcb --- /dev/null +++ b/node_modules/tslint/lib/formatters/fileslistFormatter.js @@ -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 = (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"; + }; + return Formatter; +}(abstractFormatter_1.AbstractFormatter)); +/* tslint:disable:object-literal-sort-keys */ +Formatter.metadata = { + formatterName: "filesList", + description: "Lists files containing lint errors.", + sample: "directory/myFile.ts", + consumer: "machine", +}; +exports.Formatter = Formatter; diff --git a/node_modules/tslint/lib/formatters/index.d.ts b/node_modules/tslint/lib/formatters/index.d.ts new file mode 100644 index 000000000..e954e1705 --- /dev/null +++ b/node_modules/tslint/lib/formatters/index.d.ts @@ -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. + */ +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"; diff --git a/node_modules/tslint/lib/formatters/index.js b/node_modules/tslint/lib/formatters/index.js new file mode 100644 index 000000000..213f23ddb --- /dev/null +++ b/node_modules/tslint/lib/formatters/index.js @@ -0,0 +1,34 @@ +"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; diff --git a/node_modules/tslint/lib/formatters/jsonFormatter.d.ts b/node_modules/tslint/lib/formatters/jsonFormatter.d.ts new file mode 100644 index 000000000..af3160a3f --- /dev/null +++ b/node_modules/tslint/lib/formatters/jsonFormatter.d.ts @@ -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; +} diff --git a/node_modules/tslint/lib/formatters/jsonFormatter.js b/node_modules/tslint/lib/formatters/jsonFormatter.js new file mode 100644 index 000000000..73b8fd9d1 --- /dev/null +++ b/node_modules/tslint/lib/formatters/jsonFormatter.js @@ -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 = (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); + }; + return Formatter; +}(abstractFormatter_1.AbstractFormatter)); +/* tslint:disable:object-literal-sort-keys */ +Formatter.metadata = { + formatterName: "json", + description: "Formats errors as simple JSON.", + sample: (_a = ["\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 ]"], _a.raw = ["\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 ]"], Utils.dedent(_a)), + consumer: "machine", +}; +exports.Formatter = Formatter; +var _a; diff --git a/node_modules/tslint/lib/formatters/msbuildFormatter.d.ts b/node_modules/tslint/lib/formatters/msbuildFormatter.d.ts new file mode 100644 index 000000000..6227c2b8c --- /dev/null +++ b/node_modules/tslint/lib/formatters/msbuildFormatter.d.ts @@ -0,0 +1,23 @@ +/** + * @license + * Copyright 2016 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; +} diff --git a/node_modules/tslint/lib/formatters/msbuildFormatter.js b/node_modules/tslint/lib/formatters/msbuildFormatter.js new file mode 100644 index 000000000..6f3792d14 --- /dev/null +++ b/node_modules/tslint/lib/formatters/msbuildFormatter.js @@ -0,0 +1,51 @@ +"use strict"; +/** + * @license + * Copyright 2016 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_1 = require("../utils"); +var Formatter = (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 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"; + }; + return Formatter; +}(abstractFormatter_1.AbstractFormatter)); +/* tslint:disable:object-literal-sort-keys */ +Formatter.metadata = { + formatterName: "msbuild", + description: "Formats errors for consumption by msbuild.", + descriptionDetails: (_a = ["\n The output is compatible with both msbuild and Visual Studio. All failures have the\n 'warning' severity."], _a.raw = ["\n The output is compatible with both msbuild and Visual Studio. All failures have the\n 'warning' severity."], utils_1.dedent(_a)), + sample: "myFile.ts(1,14): warning: Missing semicolon", + consumer: "machine", +}; +exports.Formatter = Formatter; +var _a; diff --git a/node_modules/tslint/lib/formatters/pmdFormatter.d.ts b/node_modules/tslint/lib/formatters/pmdFormatter.d.ts new file mode 100644 index 000000000..af3160a3f --- /dev/null +++ b/node_modules/tslint/lib/formatters/pmdFormatter.d.ts @@ -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; +} diff --git a/node_modules/tslint/lib/formatters/pmdFormatter.js b/node_modules/tslint/lib/formatters/pmdFormatter.js new file mode 100644 index 000000000..927d90428 --- /dev/null +++ b/node_modules/tslint/lib/formatters/pmdFormatter.js @@ -0,0 +1,60 @@ +"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 = (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; + }; + return Formatter; +}(abstractFormatter_1.AbstractFormatter)); +/* tslint:disable:object-literal-sort-keys */ +Formatter.metadata = { + formatterName: "pmd", + description: "Formats errors as through they were PMD output.", + descriptionDetails: "Imitates the XML output from PMD. All errors have a priority of 1.", + sample: (_a = ["\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>"], _a.raw = ["\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>"], Utils.dedent(_a)), + consumer: "machine", +}; +exports.Formatter = Formatter; +var _a; diff --git a/node_modules/tslint/lib/formatters/proseFormatter.d.ts b/node_modules/tslint/lib/formatters/proseFormatter.d.ts new file mode 100644 index 000000000..fce71e7e0 --- /dev/null +++ b/node_modules/tslint/lib/formatters/proseFormatter.d.ts @@ -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; +} diff --git a/node_modules/tslint/lib/formatters/proseFormatter.js b/node_modules/tslint/lib/formatters/proseFormatter.js new file mode 100644 index 000000000..981884a1e --- /dev/null +++ b/node_modules/tslint/lib/formatters/proseFormatter.js @@ -0,0 +1,62 @@ +"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 = (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"; + } + 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"; + }; + return Formatter; +}(abstractFormatter_1.AbstractFormatter)); +/* 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", +}; +exports.Formatter = Formatter; diff --git a/node_modules/tslint/lib/formatters/stylishFormatter.d.ts b/node_modules/tslint/lib/formatters/stylishFormatter.d.ts new file mode 100644 index 000000000..f82a678dd --- /dev/null +++ b/node_modules/tslint/lib/formatters/stylishFormatter.d.ts @@ -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(failures); + private pad(str, len); + private getPositionMaxSize(failures); + private getRuleMaxSize(failures); +} diff --git a/node_modules/tslint/lib/formatters/stylishFormatter.js b/node_modules/tslint/lib/formatters/stylishFormatter.js new file mode 100644 index 000000000..c358dcaec --- /dev/null +++ b/node_modules/tslint/lib/formatters/stylishFormatter.js @@ -0,0 +1,111 @@ +"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 colors = require("colors"); +var Utils = require("../utils"); +var Formatter = (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 = 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(); + // Output the name of each file once + if (currentFile !== fileName) { + outputLines.push(""); + outputLines.push(fileName); + currentFile = fileName; + } + var failureString = failure.getFailure(); + failureString = colors.yellow(failureString); + // Rule + var ruleName = failure.getRuleName(); + ruleName = this.pad(ruleName, ruleMaxSize); + ruleName = colors.grey(ruleName); + // Lines + var lineAndCharacter = failure.getStartPosition().getLineAndCharacter(); + var positionTuple = lineAndCharacter.line + 1 + ":" + (lineAndCharacter.character + 1); + positionTuple = this.pad(positionTuple, positionMaxSize); + positionTuple = failure.getRuleSeverity() === "warning" + ? colors.blue(failure.getRuleSeverity().toUpperCase() + ": " + positionTuple) + : colors.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; + }; + return Formatter; +}(abstractFormatter_1.AbstractFormatter)); +/* tslint:disable:object-literal-sort-keys */ +Formatter.metadata = { + formatterName: "stylish", + description: "Human-readable formatter which creates stylish messages.", + descriptionDetails: (_a = ["\n The output matches that produced by eslint's stylish formatter. Its readability\n enhanced through spacing and colouring"], _a.raw = ["\n The output matches that produced by eslint's stylish formatter. Its readability\n enhanced through spacing and colouring"], Utils.dedent(_a)), + sample: (_b = ["\n myFile.ts\n 1:14 semicolon Missing semicolon"], _b.raw = ["\n myFile.ts\n 1:14 semicolon Missing semicolon"], Utils.dedent(_b)), + consumer: "human", +}; +exports.Formatter = Formatter; +var _a, _b; diff --git a/node_modules/tslint/lib/formatters/tapFormatter.d.ts b/node_modules/tslint/lib/formatters/tapFormatter.d.ts new file mode 100644 index 000000000..b44fb7d11 --- /dev/null +++ b/node_modules/tslint/lib/formatters/tapFormatter.d.ts @@ -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(failures); +} diff --git a/node_modules/tslint/lib/formatters/tapFormatter.js b/node_modules/tslint/lib/formatters/tapFormatter.js new file mode 100644 index 000000000..1bf56b9fc --- /dev/null +++ b/node_modules/tslint/lib/formatters/tapFormatter.js @@ -0,0 +1,64 @@ +"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 = (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"]; + if (failures.length === 0) { + output = output.concat([ + "1..0 # SKIP No failures", + ]); + } + else { + output = 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 (_a = ["\n not ok ", " - ", "\n ---\n message : ", "\n severity: ", "\n data:\n ruleName: ", "\n fileName: ", "\n line: ", "\n character: ", "\n failureString: ", "\n rawLines: ", "\n ..."], _a.raw = ["\n not ok ", " - ", "\n ---\n message : ", "\n severity: ", "\n data:\n ruleName: ", "\n fileName: ", "\n line: ", "\n character: ", "\n failureString: ", "\n rawLines: ", "\n ..."], Utils.dedent(_a, String(i + 1), failureMessage, failureMessage, failureSeverity, ruleName, fileName, String(lineAndCharacter.line), String(lineAndCharacter.character), failureString, failureRaw)); + var _a; + }); + }; + return Formatter; +}(abstractFormatter_1.AbstractFormatter)); +/* 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: (_a = ["\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 ..."], _a.raw = ["\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 ..."], Utils.dedent(_a)), + consumer: "machine", +}; +exports.Formatter = Formatter; +var _a; diff --git a/node_modules/tslint/lib/formatters/verboseFormatter.d.ts b/node_modules/tslint/lib/formatters/verboseFormatter.d.ts new file mode 100644 index 000000000..94ee65563 --- /dev/null +++ b/node_modules/tslint/lib/formatters/verboseFormatter.d.ts @@ -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(failures); +} diff --git a/node_modules/tslint/lib/formatters/verboseFormatter.js b/node_modules/tslint/lib/formatters/verboseFormatter.js new file mode 100644 index 000000000..dfaf66313 --- /dev/null +++ b/node_modules/tslint/lib/formatters/verboseFormatter.js @@ -0,0 +1,50 @@ +"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 = (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) { + 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; + }); + }; + return Formatter; +}(abstractFormatter_1.AbstractFormatter)); +/* 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", +}; +exports.Formatter = Formatter; diff --git a/node_modules/tslint/lib/formatters/vsoFormatter.d.ts b/node_modules/tslint/lib/formatters/vsoFormatter.d.ts new file mode 100644 index 000000000..d5ebd9f2b --- /dev/null +++ b/node_modules/tslint/lib/formatters/vsoFormatter.d.ts @@ -0,0 +1,23 @@ +/** + * @license + * Copyright 2016 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[], warnings?: RuleFailure[]): string; +} diff --git a/node_modules/tslint/lib/formatters/vsoFormatter.js b/node_modules/tslint/lib/formatters/vsoFormatter.js new file mode 100644 index 000000000..b2c4082ed --- /dev/null +++ b/node_modules/tslint/lib/formatters/vsoFormatter.js @@ -0,0 +1,54 @@ +"use strict"; +/** + * @license + * Copyright 2016 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 = (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, warnings) { + if (warnings === void 0) { warnings = []; } + var all = failures.concat(warnings); + var outputLines = all.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"; + }; + return Formatter; +}(abstractFormatter_1.AbstractFormatter)); +/* tslint:disable:object-literal-sort-keys */ +Formatter.metadata = { + formatterName: "vso", + description: "Formats output as VSO/TFS logging commands.", + descriptionDetails: (_a = ["\n Integrates with Visual Studio Online and Team Foundation Server by outputting errors\n as 'warning' logging commands."], _a.raw = ["\n Integrates with Visual Studio Online and Team Foundation Server by outputting errors\n as 'warning' logging commands."], Utils.dedent(_a)), + sample: "##vso[task.logissue type=warning;sourcepath=myFile.ts;linenumber=1;columnnumber=14;code=semicolon;]Missing semicolon", + consumer: "machine", +}; +exports.Formatter = Formatter; +var _a; |