Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Commit

Permalink
Rename avoid-on-single-parameter to ban-single-arg-parens (#1907)
Browse files Browse the repository at this point in the history
  • Loading branch information
nchen63 authored Dec 19, 2016
1 parent 8eac3db commit 03cc097
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 15 deletions.
14 changes: 11 additions & 3 deletions docs/_data/rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,16 @@
"ruleName": "arrow-parens",
"description": "Requires parentheses around the parameters of arrow function definitions.",
"rationale": "Maintains stylistic consistency with other arrow function definitions.",
"optionsDescription": "\nif `avoid-on-single-parameter` is specified, then arrow functions with one parameter \nmust not have parentheses if removing them is allowed by TypeScript.",
"optionsDescription": "\nif `ban-single-arg-parens` is specified, then arrow functions with one parameter \nmust not have parentheses if removing them is allowed by TypeScript.",
"options": {
"type": "string",
"enum": [
"avoid-on-single-parameter"
"ban-single-arg-parens"
]
},
"optionExamples": [
"true",
"[true, avoid-on-single-parameter]"
"[true, ban-single-arg-parens]"
],
"type": "style",
"typescriptOnly": false
Expand Down Expand Up @@ -867,6 +867,14 @@
"type": "functionality",
"typescriptOnly": false
},
{
"ruleName": "no-string-throw",
"description": "Flags throwing plain strings or concatenations of strings because only Errors produce proper stack traces.",
"options": null,
"optionsDescription": "",
"type": "functionality",
"typescriptOnly": false
},
{
"ruleName": "no-switch-case-fall-through",
"description": "Disallows falling through case statements.",
Expand Down
8 changes: 4 additions & 4 deletions docs/rules/arrow-parens/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
rationale: Maintains stylistic consistency with other arrow function definitions.
optionsDescription: |-

if `avoid-on-single-parameter` is specified, then arrow functions with one parameter
if `ban-single-arg-parens` is specified, then arrow functions with one parameter
must not have parentheses if removing them is allowed by TypeScript.
options:
type: string
enum:
- avoid-on-single-parameter
- ban-single-arg-parens
optionExamples:
- 'true'
- '[true, avoid-on-single-parameter]'
- '[true, ban-single-arg-parens]'
type: style
typescriptOnly: false
layout: rule
Expand All @@ -21,7 +21,7 @@
{
"type": "string",
"enum": [
"avoid-on-single-parameter"
"ban-single-arg-parens"
]
}
---
10 changes: 5 additions & 5 deletions src/rules/arrowParensRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import * as ts from "typescript";
import * as Lint from "../index";
import { hasModifier } from "../language/utils";

const AVOID_ON_SINGLE_PARAMETER = "avoid-on-single-parameter";
const BAN_SINGLE_ARG_PARENS = "ban-single-arg-parens";

export class Rule extends Lint.Rules.AbstractRule {
/* tslint:disable:object-literal-sort-keys */
Expand All @@ -29,13 +29,13 @@ export class Rule extends Lint.Rules.AbstractRule {
description: "Requires parentheses around the parameters of arrow function definitions.",
rationale: "Maintains stylistic consistency with other arrow function definitions.",
optionsDescription: Lint.Utils.dedent`
if \`${AVOID_ON_SINGLE_PARAMETER}\` is specified, then arrow functions with one parameter
if \`${BAN_SINGLE_ARG_PARENS}\` is specified, then arrow functions with one parameter
must not have parentheses if removing them is allowed by TypeScript.`,
options: {
type: "string",
enum: [AVOID_ON_SINGLE_PARAMETER],
enum: [BAN_SINGLE_ARG_PARENS],
},
optionExamples: [`true`, `[true, ${AVOID_ON_SINGLE_PARAMETER}]`],
optionExamples: [`true`, `[true, ${BAN_SINGLE_ARG_PARENS}]`],
type: "style",
typescriptOnly: false,
};
Expand All @@ -55,7 +55,7 @@ class ArrowParensWalker extends Lint.RuleWalker {

constructor(sourceFile: ts.SourceFile, options: Lint.IOptions) {
super(sourceFile, options);
this.avoidOnSingleParameter = this.hasOption(AVOID_ON_SINGLE_PARAMETER);
this.avoidOnSingleParameter = this.hasOption(BAN_SINGLE_ARG_PARENS);
}

public visitArrowFunction(node: ts.FunctionLikeDeclaration) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"rules": {
"arrow-parens": [
true,
"avoid-on-single-parameter"
"ban-single-arg-parens"
]
},
"jsRules": {
"arrow-parens": [
true,
"avoid-on-single-parameter"
"ban-single-arg-parens"
]
}
}
}

0 comments on commit 03cc097

Please sign in to comment.