Skip to content

Commit 20aedea

Browse files
author
Rebecca Stevens
authored
Merge pull request #53 from jonaskello/rule-rename
Rename Rules
2 parents 7ccb03f + 24cde61 commit 20aedea

20 files changed

+54
-42
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ See [@typescript-eslint/parser's README.md](https://github.com/typescript-eslint
137137

138138
| Name | Description | <span title="No Object-Orientation">:see_no_evil:</span> | <span title="Lite">:hear_no_evil:</span> | <span title="Recommended">:speak_no_evil:</span> | :wrench: | :blue_heart: |
139139
| ------------------------------------------------------------ | ------------------------------------------------------------------------ | :------------------------------------------------------: | :--------------------------------------: | :----------------------------------------------: | :------: | :---------------: |
140-
| [`no-this`](./docs/rules/no-this.md) | Disallow `this` access | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | |
140+
| [`no-this-expression`](./docs/rules/no-this-expression.md) | Disallow `this` access | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | |
141141
| [`no-class`](./docs/rules/no-class.md) | Disallow classes | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | |
142142
| [`no-mixed-type`](./docs/rules/no-mixed-type.md) | Restrict types so that only members of the same kind are allowed in them | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :thought_balloon: |
143143
| [`prefer-type-literal`](./docs/rules/prefer-type-literal.md) | Use type literals over interfaces | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :thought_balloon: |
@@ -157,11 +157,11 @@ See [@typescript-eslint/parser's README.md](https://github.com/typescript-eslint
157157

158158
:see_no_evil: = `no-exceptions` Ruleset.
159159

160-
| Name | Description | <span title="No Exceptions">:see_no_evil:</span> | <span title="Lite">:hear_no_evil:</span> | <span title="Recommended">:speak_no_evil:</span> | :wrench: | :blue_heart: |
161-
| ---------------------------------------- | ----------------------------------------------------- | :----------------------------------------------: | :--------------------------------------: | :----------------------------------------------: | :------: | :----------: |
162-
| [`no-throw`](./docs/rules/no-throw.md) | Disallow throwing exceptions | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | |
163-
| [`no-try`](./docs/rules/no-try.md) | Disallow try-catch[-finally] and try-finally patterns | :heavy_check_mark: | | :heavy_check_mark: | | |
164-
| [`no-reject`](./docs/rules/no-reject.md) | Disallow rejecting Promises | | | | | |
160+
| Name | Description | <span title="No Exceptions">:see_no_evil:</span> | <span title="Lite">:hear_no_evil:</span> | <span title="Recommended">:speak_no_evil:</span> | :wrench: | :blue_heart: |
161+
| ---------------------------------------------------------- | ----------------------------------------------------- | :----------------------------------------------: | :--------------------------------------: | :----------------------------------------------: | :------: | :----------: |
162+
| [`no-throw-statement`](./docs/rules/no-throw-statement.md) | Disallow throwing exceptions | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | |
163+
| [`no-try-statement`](./docs/rules/no-try-statement.md) | Disallow try-catch[-finally] and try-finally patterns | :heavy_check_mark: | | :heavy_check_mark: | | |
164+
| [`no-promise-reject`](./docs/rules/no-promise-reject.md) | Disallow rejecting Promises | | | | | |
165165

166166
### Currying Rules
167167

docs/rules/no-class.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Disallow use of the `class` keyword.
44

55
## Rule Details
66

7-
Thanks to libraries like [recompose](https://github.com/acdlite/recompose) and Redux's [React Container components](http://redux.js.org/docs/basics/UsageWithReact.html), there's not much reason to build Components using `React.createClass` or ES6 classes anymore. The `no-this` rule makes this explicit.
7+
Thanks to libraries like [recompose](https://github.com/acdlite/recompose) and Redux's [React Container components](http://redux.js.org/docs/basics/UsageWithReact.html), there's not much reason to build Components using `React.createClass` or ES6 classes anymore. The `no-this-expression` rule makes this explicit.
88

99
```typescript
1010
const Message = React.createClass({

docs/rules/no-reject.md renamed to docs/rules/no-promise-reject.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Disallow try-catch[-finally] and try-finally patterns (no-reject)
1+
# Disallow try-catch[-finally] and try-finally patterns (no-promise-reject)
22

33
This rule disallows `Promise.reject()`.
44

55
## Rule Details
66

7-
You can view a `Promise` as a result object with built-in error (something like `{ value: number } | { error: Error }`) in which case a rejected `Promise` can be viewed as a returned result and thus fits with functional programming. You can also view a rejected promise as something similar to an exception and as such something that does not fit with functional programming. If your view is the latter you can use the `no-reject` rule to disallow rejected promises.
7+
You can view a `Promise` as a result object with built-in error (something like `{ value: T } | { error: Error }`) in which case a rejected `Promise` can be viewed as a returned result and thus fits with functional programming. You can also view a rejected promise as something similar to an exception and as such something that does not fit with functional programming. If your view is the latter you can use the `no-promise-reject` rule to disallow rejected promises.
88

99
```typescript
1010
async function divide(
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# Disallow this access (no-this)
1+
# Disallow this access (no-this-expression)
22

33
See the [no-class](./no-class.md) rule for more info.

docs/rules/no-throw.md renamed to docs/rules/no-throw-statement.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Disallow throwing exceptions (no-throw)
1+
# Disallow throwing exceptions (no-throw-statement)
22

33
This rule disallows the `throw` keyword.
44

docs/rules/no-try.md renamed to docs/rules/no-try-statement.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Disallow try-catch[-finally] and try-finally patterns (no-try)
1+
# Disallow try-catch[-finally] and try-finally patterns (no-try-statement)
22

33
This rule disallows the `try` keyword.
44

55
## Rule Details
66

7-
Try statements are not part of functional programming. See [no-throw](./no-throw.md) for more information.
7+
Try statements are not part of functional programming. See [no-throw-statement](./no-throw-statement.md) for more information.
88

99
## Options
1010

src/configs/all.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ const config = {
77
"functional/no-expression-statement": "error",
88
"functional/no-let": "error",
99
"functional/no-loop-statement": "error",
10-
"functional/no-reject": "error",
11-
"functional/no-this": "error",
12-
"functional/no-throw": "error",
13-
"functional/no-try": "error"
10+
"functional/no-promise-reject": "error",
11+
"functional/no-this-expression": "error",
12+
"functional/no-throw-statement": "error",
13+
"functional/no-try-statement": "error"
1414
},
1515
overrides: [
1616
{

src/configs/functional-lite.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const config = deepMerge(functional, {
66
rules: {
77
"functional/no-conditional-statement": "off",
88
"functional/no-expression-statement": "off",
9-
"functional/no-try": "off"
9+
"functional/no-try-statement": "off"
1010
}
1111
});
1212

src/configs/no-exceptions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import recommended from "./external-recommended";
44

55
const config = deepMerge(recommended, {
66
rules: {
7-
"functional/no-throw": "error",
8-
"functional/no-try": "error"
7+
"functional/no-throw-statement": "error",
8+
"functional/no-try-statement": "error"
99
}
1010
});
1111

src/configs/no-object-orientation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import recommended from "./external-recommended";
44

55
const config = deepMerge(recommended, {
66
rules: {
7-
"functional/no-this": "error",
7+
"functional/no-this-expression": "error",
88
"functional/no-class": "error"
99
},
1010
overrides: [

src/rules/index.ts

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,26 @@ import {
2828
name as noMixedInterfaceRuleName,
2929
rule as noMixedInterfaceRule
3030
} from "./no-mixed-type";
31-
import { name as noRejectRuleName, rule as noRejectRule } from "./no-reject";
31+
import {
32+
name as noPromiseRejectRuleName,
33+
rule as noPromiseRejectRule
34+
} from "./no-promise-reject";
3235
import {
3336
name as noReturnVoidName,
3437
rule as noReturnVoid
3538
} from "./no-return-void";
36-
import { name as noThisRuleName, rule as noThisRule } from "./no-this";
37-
import { name as noThrowRuleName, rule as noThrowRule } from "./no-throw";
38-
import { name as noTryRuleName, rule as noTryRule } from "./no-try";
39+
import {
40+
name as noThisExpressionRuleName,
41+
rule as noThisExpressionRule
42+
} from "./no-this-expression";
43+
import {
44+
name as noThrowStatementRuleName,
45+
rule as noThrowStatementRule
46+
} from "./no-throw-statement";
47+
import {
48+
name as noTryStatementRuleName,
49+
rule as noTryStatementRule
50+
} from "./no-try-statement";
3951
import {
4052
name as preferReadonlyTypesRuleName,
4153
rule as preferReadonlyTypesRule
@@ -58,11 +70,11 @@ export const rules = {
5870
[noLoopRuleName]: noLoopRule,
5971
[noMethodSignatureRuleName]: noMethodSignatureRule,
6072
[noMixedInterfaceRuleName]: noMixedInterfaceRule,
61-
[noRejectRuleName]: noRejectRule,
73+
[noPromiseRejectRuleName]: noPromiseRejectRule,
6274
[noReturnVoidName]: noReturnVoid,
63-
[noThisRuleName]: noThisRule,
64-
[noThrowRuleName]: noThrowRule,
65-
[noTryRuleName]: noTryRule,
75+
[noThisExpressionRuleName]: noThisExpressionRule,
76+
[noThrowStatementRuleName]: noThrowStatementRule,
77+
[noTryStatementRuleName]: noTryStatementRule,
6678
[preferReadonlyTypesRuleName]: preferReadonlyTypesRule,
6779
[preferTypeRuleName]: preferTypeRule
6880
};

src/rules/no-reject.ts renamed to src/rules/no-promise-reject.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
import { isIdentifier, isMemberExpression } from "../util/typeguard";
1111

1212
// The name of this rule.
13-
export const name = "no-reject" as const;
13+
export const name = "no-promise-reject" as const;
1414

1515
// The options this rule can take.
1616
type Options = {};

src/rules/no-this.ts renamed to src/rules/no-this-expression.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from "../util/rule";
1010

1111
// The name of this rule.
12-
export const name = "no-this" as const;
12+
export const name = "no-this-expression" as const;
1313

1414
// The options this rule can take.
1515
type Options = {};

src/rules/no-throw.ts renamed to src/rules/no-throw-statement.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from "../util/rule";
1010

1111
// The name of this rule.
12-
export const name = "no-throw" as const;
12+
export const name = "no-throw-statement" as const;
1313

1414
// The options this rule can take.
1515
type Options = {};

src/rules/no-try.ts renamed to src/rules/no-try-statement.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from "../util/rule";
1010

1111
// The name of this rule.
12-
export const name = "no-try" as const;
12+
export const name = "no-try-statement" as const;
1313

1414
// The options this rule can take.
1515
type Options = {

src/util/conditional-imports/.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"rules": {
33
"@typescript-eslint/no-require-imports": "off",
44
"functional/functional-parameters": "off",
5-
"functional/no-try": "off"
5+
"functional/no-try-statement": "off"
66
}
77
}

tests/rules/no-reject.test.ts renamed to tests/rules/no-promise-reject.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**
2-
* @file Tests for no-reject.
2+
* @file Tests for no-promise-reject.
33
*/
44

55
import dedent from "dedent";
66
import { RuleTester } from "eslint";
77

8-
import { name, rule } from "../../src/rules/no-reject";
8+
import { name, rule } from "../../src/rules/no-promise-reject";
99

1010
import { es6, typescript } from "../helpers/configs";
1111
import {

tests/rules/no-this.test.ts renamed to tests/rules/no-this-expression.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/**
2-
* @file Tests for no-this.
2+
* @file Tests for no-this-expression.
33
*/
44

55
import { RuleTester } from "eslint";
66

7-
import { name, rule } from "../../src/rules/no-this";
7+
import { name, rule } from "../../src/rules/no-this-expression";
88

99
import { es3, typescript } from "../helpers/configs";
1010
import {

tests/rules/no-throw.test.ts renamed to tests/rules/no-throw-statement.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**
2-
* @file Tests for no-throw.
2+
* @file Tests for no-throw-statement.
33
*/
44

55
import dedent from "dedent";
66
import { RuleTester } from "eslint";
77

8-
import { name, rule } from "../../src/rules/no-throw";
8+
import { name, rule } from "../../src/rules/no-throw-statement";
99

1010
import { es3, typescript } from "../helpers/configs";
1111
import {

tests/rules/no-try.test.ts renamed to tests/rules/no-try-statement.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/**
2-
* @file Tests for no-try.
2+
* @file Tests for no-try-statement.
33
*/
44

55
import { RuleTester } from "eslint";
66

7-
import { name, rule } from "../../src/rules/no-try";
7+
import { name, rule } from "../../src/rules/no-try-statement";
88

99
import { es3, typescript } from "../helpers/configs";
1010
import {

0 commit comments

Comments
 (0)