Skip to content

Commit c4ccf3d

Browse files
docs: update readme for recommended standard rules
1 parent f10e4cc commit c4ccf3d

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -264,17 +264,20 @@ Without this rule, function parameters are mutable.
264264

265265
This rule is helpful when converting from an imperative code style to a functional one.
266266

267-
### [@typescript-eslint/explicit-function-return-type](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-function-return-type.md)
267+
### [@typescript-eslint/prefer-readonly](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-readonly.md)
268268

269-
For performance reasons, eslint-plugin-functional does not check implicit return types. So for example this function will return a mutable array but will not be detected:
269+
This rule is helpful when working with classes.
270270

271-
```js
272-
function foo() {
273-
return [1, 2, 3];
274-
}
275-
```
271+
### [@typescript-eslint/prefer-readonly-parameter-types](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md)
272+
273+
Functional functions must not modify any data passed into them.
274+
This rule marks mutable parameters as a violation as they prevent readonly versions of that data from being passed in.
275+
276+
However, due to many 3rd-party libraries only providing mutable versions of their types, often it can not be easy to satisfy this rule. Thus by default we only enable this rule with the "warn" serverity rather than "error".
277+
278+
### [@typescript-eslint/switch-exhaustiveness-check](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/switch-exhaustiveness-check.md)
276279

277-
To avoid this situation you can enable `@typescript-eslint/explicit-function-return-type`. Now the above function is forced to declare the return type and the mutability will be detected.
280+
Although our [no-conditional-statement](./docs/rules/no-conditional-statement.md) rule also performs this check, this rule has a fixer that will implement the unimplemented cases which can be useful.
278281

279282
## How to contribute
280283

0 commit comments

Comments
 (0)