From 485dfa15aeaf63c3770810a0df108f8532bef949 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Sat, 27 May 2017 16:00:54 -0700 Subject: [PATCH] Add "format" rule category --- docs/rules/index.md | 6 ++++++ src/language/rule/rule.ts | 2 +- src/rules/alignRule.ts | 2 +- src/rules/arrowParensRule.ts | 2 +- src/rules/eoflineRule.ts | 2 +- src/rules/importSpacingRule.ts | 2 +- src/rules/indentRule.ts | 2 +- src/rules/jsdocFormatRule.ts | 2 +- src/rules/linebreakStyleRule.ts | 2 +- src/rules/maxLineLengthRule.ts | 2 +- src/rules/newParensRule.ts | 2 +- src/rules/newlineBeforeReturnRule.ts | 2 +- src/rules/noConsecutiveBlankLinesRule.ts | 2 +- src/rules/noIrregularWhitespaceRule.ts | 2 +- src/rules/noTrailingWhitespaceRule.ts | 2 +- src/rules/numberLiteralFormatRule.ts | 2 +- src/rules/quotemarkRule.ts | 2 +- src/rules/semicolonRule.ts | 2 +- src/rules/trailingCommaRule.ts | 2 +- src/rules/typedefWhitespaceRule.ts | 2 +- src/rules/whitespaceRule.ts | 2 +- 21 files changed, 26 insertions(+), 20 deletions(-) diff --git a/docs/rules/index.md b/docs/rules/index.md index cb4f6501876..a44479ebd93 100644 --- a/docs/rules/index.md +++ b/docs/rules/index.md @@ -31,3 +31,9 @@ _These rules make code maintenance easier_: _These rules enforce consistent style across your codebase_: {% include rule_list.html ruleType="style" %} + +### Format + +_These rules enforce consistent use of whitespace and punctuation_: + +{% include rule_list.html ruleType="format" %} diff --git a/src/language/rule/rule.ts b/src/language/rule/rule.ts index 142040cf005..caa1f864bd8 100644 --- a/src/language/rule/rule.ts +++ b/src/language/rule/rule.ts @@ -91,7 +91,7 @@ export interface IRuleMetadata { typescriptOnly: boolean; } -export type RuleType = "functionality" | "maintainability" | "style" | "typescript"; +export type RuleType = "functionality" | "maintainability" | "style" | "typescript" | "format"; export type RuleSeverity = "warning" | "error" | "off"; diff --git a/src/rules/alignRule.ts b/src/rules/alignRule.ts index ecb7828b56b..b02d1715f71 100644 --- a/src/rules/alignRule.ts +++ b/src/rules/alignRule.ts @@ -60,7 +60,7 @@ export class Rule extends Lint.Rules.AbstractRule { maxLength: 5, }, optionExamples: [[true, "parameters", "statements"]], - type: "style", + type: "format", typescriptOnly: false, }; /* tslint:enable:object-literal-sort-keys */ diff --git a/src/rules/arrowParensRule.ts b/src/rules/arrowParensRule.ts index 4de40e3c952..a0bbf3318ab 100644 --- a/src/rules/arrowParensRule.ts +++ b/src/rules/arrowParensRule.ts @@ -41,7 +41,7 @@ export class Rule extends Lint.Rules.AbstractRule { enum: [BAN_SINGLE_ARG_PARENS], }, optionExamples: [true, [true, BAN_SINGLE_ARG_PARENS]], - type: "style", + type: "format", typescriptOnly: false, }; /* tslint:enable:object-literal-sort-keys */ diff --git a/src/rules/eoflineRule.ts b/src/rules/eoflineRule.ts index 1a5c3f09ed7..daca9b40dd6 100644 --- a/src/rules/eoflineRule.ts +++ b/src/rules/eoflineRule.ts @@ -30,7 +30,7 @@ export class Rule extends Lint.Rules.AbstractRule { options: null, optionExamples: [true], hasFix: true, - type: "maintainability", + type: "format", typescriptOnly: false, }; /* tslint:enable:object-literal-sort-keys */ diff --git a/src/rules/importSpacingRule.ts b/src/rules/importSpacingRule.ts index 64b759377c2..2af24617074 100644 --- a/src/rules/importSpacingRule.ts +++ b/src/rules/importSpacingRule.ts @@ -29,7 +29,7 @@ export class Rule extends Lint.Rules.AbstractRule { optionsDescription: "Not configurable.", options: null, optionExamples: [true], - type: "style", + type: "format", typescriptOnly: false, }; diff --git a/src/rules/indentRule.ts b/src/rules/indentRule.ts index f332e0834df..d32c293a4d2 100644 --- a/src/rules/indentRule.ts +++ b/src/rules/indentRule.ts @@ -65,7 +65,7 @@ export class Rule extends Lint.Rules.AbstractRule { [true, OPTION_USE_SPACES, OPTION_INDENT_SIZE_4], [true, OPTION_USE_TABS, OPTION_INDENT_SIZE_2], ], - type: "maintainability", + type: "format", typescriptOnly: false, }; /* tslint:enable:object-literal-sort-keys */ diff --git a/src/rules/jsdocFormatRule.ts b/src/rules/jsdocFormatRule.ts index 1a6fecd6fa3..931fc76986b 100644 --- a/src/rules/jsdocFormatRule.ts +++ b/src/rules/jsdocFormatRule.ts @@ -36,7 +36,7 @@ export class Rule extends Lint.Rules.AbstractRule { optionsDescription: "Not configurable.", options: null, optionExamples: [true], - type: "style", + type: "format", typescriptOnly: false, }; /* tslint:enable:object-literal-sort-keys */ diff --git a/src/rules/linebreakStyleRule.ts b/src/rules/linebreakStyleRule.ts index 1e3453c5d0b..bd6e566bbf8 100644 --- a/src/rules/linebreakStyleRule.ts +++ b/src/rules/linebreakStyleRule.ts @@ -37,7 +37,7 @@ export class Rule extends Lint.Rules.AbstractRule { enum: [OPTION_LINEBREAK_STYLE_LF, OPTION_LINEBREAK_STYLE_CRLF], }, optionExamples: [[true, OPTION_LINEBREAK_STYLE_LF], [true, OPTION_LINEBREAK_STYLE_CRLF]], - type: "maintainability", + type: "format", typescriptOnly: false, hasFix: true, }; diff --git a/src/rules/maxLineLengthRule.ts b/src/rules/maxLineLengthRule.ts index f047978a651..2b6d8c96aca 100644 --- a/src/rules/maxLineLengthRule.ts +++ b/src/rules/maxLineLengthRule.ts @@ -35,7 +35,7 @@ export class Rule extends Lint.Rules.AbstractRule { minimum: "1", }, optionExamples: [[true, 120]], - type: "maintainability", + type: "format", typescriptOnly: false, }; /* tslint:enable:object-literal-sort-keys */ diff --git a/src/rules/newParensRule.ts b/src/rules/newParensRule.ts index b110a9743e4..d0edfc829ec 100644 --- a/src/rules/newParensRule.ts +++ b/src/rules/newParensRule.ts @@ -28,7 +28,7 @@ export class Rule extends Lint.Rules.AbstractRule { optionsDescription: "Not configurable.", options: null, optionExamples: [true], - type: "style", + type: "format", typescriptOnly: false, }; /* tslint:enable:object-literal-sort-keys */ diff --git a/src/rules/newlineBeforeReturnRule.ts b/src/rules/newlineBeforeReturnRule.ts index c5b63391cd7..a1bb97a1335 100644 --- a/src/rules/newlineBeforeReturnRule.ts +++ b/src/rules/newlineBeforeReturnRule.ts @@ -28,7 +28,7 @@ export class Rule extends Lint.Rules.AbstractRule { optionsDescription: "Not configurable.", options: {}, optionExamples: [true], - type: "style", + type: "format", typescriptOnly: false, }; /* tslint:enable:object-literal-sort-keys */ diff --git a/src/rules/noConsecutiveBlankLinesRule.ts b/src/rules/noConsecutiveBlankLinesRule.ts index c34b0a17a16..0ef055f9b3e 100644 --- a/src/rules/noConsecutiveBlankLinesRule.ts +++ b/src/rules/noConsecutiveBlankLinesRule.ts @@ -37,7 +37,7 @@ export class Rule extends Lint.Rules.AbstractRule { minimum: "1", }, optionExamples: [true, [true, 2]], - type: "style", + type: "format", typescriptOnly: false, }; /* tslint:enable:object-literal-sort-keys */ diff --git a/src/rules/noIrregularWhitespaceRule.ts b/src/rules/noIrregularWhitespaceRule.ts index 1cd250cf7d8..ac60bb57374 100644 --- a/src/rules/noIrregularWhitespaceRule.ts +++ b/src/rules/noIrregularWhitespaceRule.ts @@ -28,7 +28,7 @@ export class Rule extends Lint.Rules.AbstractRule { optionsDescription: "Not configurable.", options: null, optionExamples: [true], - type: "style", + type: "format", typescriptOnly: false, }; /* tslint:enable:object-literal-sort-keys */ diff --git a/src/rules/noTrailingWhitespaceRule.ts b/src/rules/noTrailingWhitespaceRule.ts index d2f52de4065..61da6a7f71e 100644 --- a/src/rules/noTrailingWhitespaceRule.ts +++ b/src/rules/noTrailingWhitespaceRule.ts @@ -56,7 +56,7 @@ export class Rule extends Lint.Rules.AbstractRule { [true, OPTION_IGNORE_COMMENTS], [true, OPTION_IGNORE_JSDOC], ], - type: "style", + type: "format", typescriptOnly: false, }; /* tslint:enable:object-literal-sort-keys */ diff --git a/src/rules/numberLiteralFormatRule.ts b/src/rules/numberLiteralFormatRule.ts index aec43a4ed67..7b4754c92cb 100644 --- a/src/rules/numberLiteralFormatRule.ts +++ b/src/rules/numberLiteralFormatRule.ts @@ -29,7 +29,7 @@ export class Rule extends Lint.Rules.AbstractRule { optionsDescription: "Not configurable.", options: null, optionExamples: [true], - type: "style", + type: "format", typescriptOnly: false, }; /* tslint:enable:object-literal-sort-keys */ diff --git a/src/rules/quotemarkRule.ts b/src/rules/quotemarkRule.ts index 414c39ea692..c9db2f2c5da 100644 --- a/src/rules/quotemarkRule.ts +++ b/src/rules/quotemarkRule.ts @@ -64,7 +64,7 @@ export class Rule extends Lint.Rules.AbstractRule { [true, OPTION_SINGLE, OPTION_AVOID_ESCAPE, OPTION_AVOID_TEMPLATE], [true, OPTION_SINGLE, OPTION_JSX_DOUBLE], ], - type: "style", + type: "format", typescriptOnly: false, }; /* tslint:enable:object-literal-sort-keys */ diff --git a/src/rules/semicolonRule.ts b/src/rules/semicolonRule.ts index 9ec6f246412..cf6d10552ee 100644 --- a/src/rules/semicolonRule.ts +++ b/src/rules/semicolonRule.ts @@ -66,7 +66,7 @@ export class Rule extends Lint.Rules.AbstractRule { [true, OPTION_ALWAYS, OPTION_IGNORE_INTERFACES], [true, OPTION_ALWAYS, OPTION_IGNORE_BOUND_CLASS_METHODS], ], - type: "style", + type: "format", typescriptOnly: false, }; /* tslint:enable:object-literal-sort-keys */ diff --git a/src/rules/trailingCommaRule.ts b/src/rules/trailingCommaRule.ts index 66023c1220d..11307c347b4 100644 --- a/src/rules/trailingCommaRule.ts +++ b/src/rules/trailingCommaRule.ts @@ -110,7 +110,7 @@ export class Rule extends Lint.Rules.AbstractRule { }, ], ], - type: "maintainability", + type: "format", typescriptOnly: false, }; /* tslint:enable:object-literal-sort-keys */ diff --git a/src/rules/typedefWhitespaceRule.ts b/src/rules/typedefWhitespaceRule.ts index 485c1cbc1c8..558f3922e01 100644 --- a/src/rules/typedefWhitespaceRule.ts +++ b/src/rules/typedefWhitespaceRule.ts @@ -84,7 +84,7 @@ export class Rule extends Lint.Rules.AbstractRule { }, ], ], - type: "typescript", + type: "format", typescriptOnly: true, hasFix: true, }; diff --git a/src/rules/whitespaceRule.ts b/src/rules/whitespaceRule.ts index ea90a6a9ac4..c5b7e07dbd3 100644 --- a/src/rules/whitespaceRule.ts +++ b/src/rules/whitespaceRule.ts @@ -58,7 +58,7 @@ export class Rule extends Lint.Rules.AbstractRule { maxLength: 7, }, optionExamples: [[true, "check-branch", "check-operator", "check-typecast"]], - type: "style", + type: "format", typescriptOnly: false, };