diff options
| author | Florian Dold <florian.dold@gmail.com> | 2019-03-27 21:01:33 +0100 |
|---|---|---|
| committer | Florian Dold <florian.dold@gmail.com> | 2019-03-27 21:01:33 +0100 |
| commit | cc97a4dd2a967e1c2273bd5f4c5f49a5bf2e2585 (patch) | |
| tree | 92c5d88706a6ffc654d1b133618d357890e7096b /node_modules/tslint/lib/language/rule | |
| parent | 3771b4d6b67b34c130f3a9a1a15f42deefdb2eda (diff) | |
remove node_modules
Diffstat (limited to 'node_modules/tslint/lib/language/rule')
8 files changed, 0 insertions, 563 deletions
diff --git a/node_modules/tslint/lib/language/rule/abstractRule.d.ts b/node_modules/tslint/lib/language/rule/abstractRule.d.ts deleted file mode 100644 index 65ed4a1b9..000000000 --- a/node_modules/tslint/lib/language/rule/abstractRule.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * @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 * as ts from "typescript"; -import { IWalker, WalkContext } from "../walker"; -import { IOptions, IRule, IRuleMetadata, RuleFailure, RuleSeverity } from "./rule"; -export declare type NoInfer<T> = T & { - [K in keyof T]: T[K]; -}; -export declare abstract class AbstractRule implements IRule { - private readonly options; - static metadata: IRuleMetadata; - protected readonly ruleArguments: any[]; - protected readonly ruleSeverity: RuleSeverity; - ruleName: string; - constructor(options: IOptions); - getOptions(): IOptions; - abstract apply(sourceFile: ts.SourceFile): RuleFailure[]; - applyWithWalker(walker: IWalker): RuleFailure[]; - isEnabled(): boolean; - protected applyWithFunction(sourceFile: ts.SourceFile, walkFn: (ctx: WalkContext<void>) => void): RuleFailure[]; - protected applyWithFunction<T>(sourceFile: ts.SourceFile, walkFn: (ctx: WalkContext<T>) => void, options: NoInfer<T>): RuleFailure[]; - protected applyWithFunction<T, U>(sourceFile: ts.SourceFile, walkFn: (ctx: WalkContext<T>, programOrChecker: U) => void, options: NoInfer<T>, checker: NoInfer<U>): RuleFailure[]; - /** - * @deprecated - * Failures will be filtered based on `tslint:disable` comments by tslint. - * This method now does nothing. - */ - protected filterFailures(failures: RuleFailure[]): RuleFailure[]; -} diff --git a/node_modules/tslint/lib/language/rule/abstractRule.js b/node_modules/tslint/lib/language/rule/abstractRule.js deleted file mode 100644 index 879ac31b8..000000000 --- a/node_modules/tslint/lib/language/rule/abstractRule.js +++ /dev/null @@ -1,50 +0,0 @@ -"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 walker_1 = require("../walker"); -var AbstractRule = /** @class */ (function () { - function AbstractRule(options) { - this.options = options; - this.ruleName = options.ruleName; - this.ruleArguments = options.ruleArguments; - this.ruleSeverity = options.ruleSeverity; - } - AbstractRule.prototype.getOptions = function () { - return this.options; - }; - AbstractRule.prototype.applyWithWalker = function (walker) { - walker.walk(walker.getSourceFile()); - return walker.getFailures(); - }; - AbstractRule.prototype.isEnabled = function () { - return this.ruleSeverity !== "off"; - }; - AbstractRule.prototype.applyWithFunction = function (sourceFile, walkFn, options, programOrChecker) { - var ctx = new walker_1.WalkContext(sourceFile, this.ruleName, options); - walkFn(ctx, programOrChecker); - return ctx.failures; - }; - /** - * @deprecated - * Failures will be filtered based on `tslint:disable` comments by tslint. - * This method now does nothing. - */ - AbstractRule.prototype.filterFailures = function (failures) { return failures; }; - return AbstractRule; -}()); -exports.AbstractRule = AbstractRule; diff --git a/node_modules/tslint/lib/language/rule/optionallyTypedRule.d.ts b/node_modules/tslint/lib/language/rule/optionallyTypedRule.d.ts deleted file mode 100644 index f12d74f44..000000000 --- a/node_modules/tslint/lib/language/rule/optionallyTypedRule.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * @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 * as ts from "typescript"; -import { AbstractRule } from "./abstractRule"; -import { ITypedRule, RuleFailure } from "./rule"; -export declare abstract class OptionallyTypedRule extends AbstractRule implements ITypedRule { - abstract applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[]; -} diff --git a/node_modules/tslint/lib/language/rule/optionallyTypedRule.js b/node_modules/tslint/lib/language/rule/optionallyTypedRule.js deleted file mode 100644 index 1aefda55e..000000000 --- a/node_modules/tslint/lib/language/rule/optionallyTypedRule.js +++ /dev/null @@ -1,28 +0,0 @@ -"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 abstractRule_1 = require("./abstractRule"); -var OptionallyTypedRule = /** @class */ (function (_super) { - tslib_1.__extends(OptionallyTypedRule, _super); - function OptionallyTypedRule() { - return _super !== null && _super.apply(this, arguments) || this; - } - return OptionallyTypedRule; -}(abstractRule_1.AbstractRule)); -exports.OptionallyTypedRule = OptionallyTypedRule; diff --git a/node_modules/tslint/lib/language/rule/rule.d.ts b/node_modules/tslint/lib/language/rule/rule.d.ts deleted file mode 100644 index e37861c36..000000000 --- a/node_modules/tslint/lib/language/rule/rule.d.ts +++ /dev/null @@ -1,189 +0,0 @@ -/** - * @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 * as ts from "typescript"; -import { IWalker } from "../walker"; -export interface RuleConstructor { - metadata: IRuleMetadata; - new (options: IOptions): IRule; -} -export interface IRuleMetadata { - /** - * The kebab-case name of the rule. - */ - ruleName: string; - /** - * The type of the rule - its overall purpose - */ - type: RuleType; - /** - * A rule deprecation message, if applicable. - */ - deprecationMessage?: string; - /** - * A short, one line description of what the rule does. - */ - description: string; - /** - * More elaborate details about the rule. - */ - descriptionDetails?: string; - /** - * Whether or not the rule will provide fix suggestions. - */ - hasFix?: boolean; - /** - * An explanation of the available options for the rule. - */ - optionsDescription: string; - /** - * Schema of the options the rule accepts. - * The first boolean for whether the rule is enabled or not is already implied. - * This field describes the options after that boolean. - * If null, this rule has no options and is not configurable. - */ - options: any; - /** - * Examples of what a standard config for the rule might look like. - * Using a string[] here is deprecated. Write the options as a JSON object instead. - */ - optionExamples?: Array<true | any[]> | string[]; - /** - * An explanation of why the rule is useful. - */ - rationale?: string; - /** - * Whether or not the rule requires type info to run. - */ - requiresTypeInfo?: boolean; - /** - * Whether or not the rule use for TypeScript only. If `false`, this rule may be used with .js files. - */ - typescriptOnly: boolean; - /** - * Examples demonstrating what the lint rule will pass and fail - */ - codeExamples?: ICodeExample[]; -} -export declare type RuleType = "functionality" | "maintainability" | "style" | "typescript"; -export declare type RuleSeverity = "warning" | "error" | "off"; -export interface ICodeExample { - config: string; - description: string; - pass: string; - fail?: string; -} -export interface IOptions { - ruleArguments: any[]; - ruleSeverity: RuleSeverity; - ruleName: string; - /** - * @deprecated - * Tslint now handles disables itself. - * This will be empty. - */ - disabledIntervals: IDisabledInterval[]; -} -/** - * @deprecated - * These are now handled internally. - */ -export interface IDisabledInterval { - startPosition: number; - endPosition: number; -} -export interface IRule { - getOptions(): IOptions; - isEnabled(): boolean; - apply(sourceFile: ts.SourceFile): RuleFailure[]; - applyWithWalker(walker: IWalker): RuleFailure[]; -} -export interface ITypedRule extends IRule { - applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[]; -} -export interface IRuleFailureJson { - endPosition: IRuleFailurePositionJson; - failure: string; - fix?: FixJson; - name: string; - ruleSeverity: string; - ruleName: string; - startPosition: IRuleFailurePositionJson; -} -export interface IRuleFailurePositionJson { - character: number; - line: number; - position: number; -} -export declare function isTypedRule(rule: IRule): rule is ITypedRule; -export interface ReplacementJson { - innerStart: number; - innerLength: number; - innerText: string; -} -export declare class Replacement { - readonly start: number; - readonly length: number; - readonly text: string; - static applyFixes(content: string, fixes: Fix[]): string; - static applyAll(content: string, replacements: Replacement[]): string; - static replaceNode(node: ts.Node, text: string, sourceFile?: ts.SourceFile): Replacement; - static replaceFromTo(start: number, end: number, text: string): Replacement; - static deleteText(start: number, length: number): Replacement; - static deleteFromTo(start: number, end: number): Replacement; - static appendText(start: number, text: string): Replacement; - constructor(start: number, length: number, text: string); - readonly end: number; - apply(content: string): string; - toJson(): ReplacementJson; -} -export declare class RuleFailurePosition { - private readonly position; - private readonly lineAndCharacter; - constructor(position: number, lineAndCharacter: ts.LineAndCharacter); - getPosition(): number; - getLineAndCharacter(): ts.LineAndCharacter; - toJson(): IRuleFailurePositionJson; - equals(ruleFailurePosition: RuleFailurePosition): boolean; -} -export declare type Fix = Replacement | Replacement[]; -export declare type FixJson = ReplacementJson | ReplacementJson[]; -export declare class RuleFailure { - private readonly sourceFile; - private readonly failure; - private readonly ruleName; - private readonly fix?; - private readonly fileName; - private readonly startPosition; - private readonly endPosition; - private readonly rawLines; - private ruleSeverity; - static compare(a: RuleFailure, b: RuleFailure): number; - constructor(sourceFile: ts.SourceFile, start: number, end: number, failure: string, ruleName: string, fix?: Replacement | Replacement[] | undefined); - getFileName(): string; - getRuleName(): string; - getStartPosition(): RuleFailurePosition; - getEndPosition(): RuleFailurePosition; - getFailure(): string; - hasFix(): boolean; - getFix(): Replacement | Replacement[] | undefined; - getRawLines(): string; - getRuleSeverity(): RuleSeverity; - setRuleSeverity(value: RuleSeverity): void; - toJson(): IRuleFailureJson; - equals(ruleFailure: RuleFailure): boolean; - private createFailurePosition; -} diff --git a/node_modules/tslint/lib/language/rule/rule.js b/node_modules/tslint/lib/language/rule/rule.js deleted file mode 100644 index d9c251842..000000000 --- a/node_modules/tslint/lib/language/rule/rule.js +++ /dev/null @@ -1,174 +0,0 @@ -"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 utils_1 = require("../../utils"); -function isTypedRule(rule) { - return "applyWithProgram" in rule; -} -exports.isTypedRule = isTypedRule; -var Replacement = /** @class */ (function () { - function Replacement(start, length, text) { - this.start = start; - this.length = length; - this.text = text; - } - Replacement.applyFixes = function (content, fixes) { - return this.applyAll(content, utils_1.flatMap(fixes, utils_1.arrayify)); - }; - Replacement.applyAll = function (content, replacements) { - // sort in reverse so that diffs are properly applied - replacements.sort(function (a, b) { return b.end !== a.end ? b.end - a.end : b.start - a.start; }); - return replacements.reduce(function (text, r) { return r.apply(text); }, content); - }; - Replacement.replaceNode = function (node, text, sourceFile) { - return this.replaceFromTo(node.getStart(sourceFile), node.getEnd(), text); - }; - Replacement.replaceFromTo = function (start, end, text) { - return new Replacement(start, end - start, text); - }; - Replacement.deleteText = function (start, length) { - return new Replacement(start, length, ""); - }; - Replacement.deleteFromTo = function (start, end) { - return new Replacement(start, end - start, ""); - }; - Replacement.appendText = function (start, text) { - return new Replacement(start, 0, text); - }; - Object.defineProperty(Replacement.prototype, "end", { - get: function () { - return this.start + this.length; - }, - enumerable: true, - configurable: true - }); - Replacement.prototype.apply = function (content) { - return content.substring(0, this.start) + this.text + content.substring(this.start + this.length); - }; - Replacement.prototype.toJson = function () { - // tslint:disable object-literal-sort-keys - return { - innerStart: this.start, - innerLength: this.length, - innerText: this.text, - }; - // tslint:enable object-literal-sort-keys - }; - return Replacement; -}()); -exports.Replacement = Replacement; -var RuleFailurePosition = /** @class */ (function () { - function RuleFailurePosition(position, lineAndCharacter) { - this.position = position; - this.lineAndCharacter = lineAndCharacter; - } - RuleFailurePosition.prototype.getPosition = function () { - return this.position; - }; - RuleFailurePosition.prototype.getLineAndCharacter = function () { - return this.lineAndCharacter; - }; - RuleFailurePosition.prototype.toJson = function () { - return { - character: this.lineAndCharacter.character, - line: this.lineAndCharacter.line, - position: this.position, - }; - }; - RuleFailurePosition.prototype.equals = function (ruleFailurePosition) { - var ll = this.lineAndCharacter; - var rr = ruleFailurePosition.lineAndCharacter; - return this.position === ruleFailurePosition.position - && ll.line === rr.line - && ll.character === rr.character; - }; - return RuleFailurePosition; -}()); -exports.RuleFailurePosition = RuleFailurePosition; -var RuleFailure = /** @class */ (function () { - function RuleFailure(sourceFile, start, end, failure, ruleName, fix) { - this.sourceFile = sourceFile; - this.failure = failure; - this.ruleName = ruleName; - this.fix = fix; - this.fileName = sourceFile.fileName; - this.startPosition = this.createFailurePosition(start); - this.endPosition = this.createFailurePosition(end); - this.rawLines = sourceFile.text; - this.ruleSeverity = "error"; - } - RuleFailure.compare = function (a, b) { - if (a.fileName !== b.fileName) { - return a.fileName < b.fileName ? -1 : 1; - } - return a.startPosition.getPosition() - b.startPosition.getPosition(); - }; - RuleFailure.prototype.getFileName = function () { - return this.fileName; - }; - RuleFailure.prototype.getRuleName = function () { - return this.ruleName; - }; - RuleFailure.prototype.getStartPosition = function () { - return this.startPosition; - }; - RuleFailure.prototype.getEndPosition = function () { - return this.endPosition; - }; - RuleFailure.prototype.getFailure = function () { - return this.failure; - }; - RuleFailure.prototype.hasFix = function () { - return this.fix !== undefined; - }; - RuleFailure.prototype.getFix = function () { - return this.fix; - }; - RuleFailure.prototype.getRawLines = function () { - return this.rawLines; - }; - RuleFailure.prototype.getRuleSeverity = function () { - return this.ruleSeverity; - }; - RuleFailure.prototype.setRuleSeverity = function (value) { - this.ruleSeverity = value; - }; - RuleFailure.prototype.toJson = function () { - return { - endPosition: this.endPosition.toJson(), - failure: this.failure, - fix: this.fix === undefined ? undefined : Array.isArray(this.fix) ? this.fix.map(function (r) { return r.toJson(); }) : this.fix.toJson(), - name: this.fileName, - ruleName: this.ruleName, - ruleSeverity: this.ruleSeverity.toUpperCase(), - startPosition: this.startPosition.toJson(), - }; - }; - RuleFailure.prototype.equals = function (ruleFailure) { - return this.failure === ruleFailure.getFailure() - && this.fileName === ruleFailure.getFileName() - && this.startPosition.equals(ruleFailure.getStartPosition()) - && this.endPosition.equals(ruleFailure.getEndPosition()); - }; - RuleFailure.prototype.createFailurePosition = function (position) { - var lineAndCharacter = this.sourceFile.getLineAndCharacterOfPosition(position); - return new RuleFailurePosition(position, lineAndCharacter); - }; - return RuleFailure; -}()); -exports.RuleFailure = RuleFailure; diff --git a/node_modules/tslint/lib/language/rule/typedRule.d.ts b/node_modules/tslint/lib/language/rule/typedRule.d.ts deleted file mode 100644 index a4d1fcca0..000000000 --- a/node_modules/tslint/lib/language/rule/typedRule.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @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 * as ts from "typescript"; -import { AbstractRule } from "./abstractRule"; -import { ITypedRule, RuleFailure } from "./rule"; -export declare abstract class TypedRule extends AbstractRule implements ITypedRule { - apply(): RuleFailure[]; - abstract applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[]; -} diff --git a/node_modules/tslint/lib/language/rule/typedRule.js b/node_modules/tslint/lib/language/rule/typedRule.js deleted file mode 100644 index 83873d49f..000000000 --- a/node_modules/tslint/lib/language/rule/typedRule.js +++ /dev/null @@ -1,34 +0,0 @@ -"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 error_1 = require("../../error"); -var abstractRule_1 = require("./abstractRule"); -var TypedRule = /** @class */ (function (_super) { - tslib_1.__extends(TypedRule, _super); - function TypedRule() { - return _super !== null && _super.apply(this, arguments) || this; - } - TypedRule.prototype.apply = function () { - // if no program is given to the linter, show an error - error_1.showWarningOnce("Warning: The '" + this.ruleName + "' rule requires type information."); - return []; - }; - return TypedRule; -}(abstractRule_1.AbstractRule)); -exports.TypedRule = TypedRule; |
