eslint-plugin-functype 2.0.1 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# eslint-plugin-functype
|
|
2
|
+
|
|
3
|
+
Custom ESLint rules for functional TypeScript with [functype](https://github.com/jordanburke/functype). Encourages idiomatic functype patterns like `Option`, `Either`, `List`, `Do` notation, and safe data access.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -D eslint-plugin-functype eslint
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
// eslint.config.mjs
|
|
15
|
+
import functype from "eslint-plugin-functype"
|
|
16
|
+
|
|
17
|
+
export default [functype.configs.recommended]
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Strict mode
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
import functype from "eslint-plugin-functype"
|
|
24
|
+
|
|
25
|
+
export default [functype.configs.strict]
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Rules
|
|
29
|
+
|
|
30
|
+
| Rule | Recommended | Strict | Description |
|
|
31
|
+
| ------------------------------ | :---------: | :----: | -------------------------------------------------------- |
|
|
32
|
+
| `functype/prefer-option` | warn | error | Use `Option`/`Some`/`None` instead of `null`/`undefined` |
|
|
33
|
+
| `functype/prefer-either` | warn | error | Use `Either`/`Right`/`Left` instead of throwing |
|
|
34
|
+
| `functype/prefer-fold` | warn | warn | Use `fold`/`match` instead of manual unwrapping |
|
|
35
|
+
| `functype/prefer-map` | warn | warn | Use `map` instead of manual option/either checks |
|
|
36
|
+
| `functype/prefer-flatmap` | warn | warn | Use `flatMap` instead of nested `map` |
|
|
37
|
+
| `functype/no-imperative-loops` | warn | warn | Use `List` methods instead of imperative loops |
|
|
38
|
+
| `functype/prefer-do-notation` | warn | warn | Use `Do` notation for chained operations |
|
|
39
|
+
| `functype/no-get-unsafe` | off | error | Disallow unsafe `.get()` on `Option`/`Either` |
|
|
40
|
+
| `functype/prefer-list` | off | warn | Use `List` instead of native arrays |
|
|
41
|
+
|
|
42
|
+
## Combining with eslint-config-functype
|
|
43
|
+
|
|
44
|
+
For a complete setup with functional rules, TypeScript, Prettier, and import sorting:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm install -D eslint-config-functype eslint-plugin-functype
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```js
|
|
51
|
+
import recommended from "eslint-config-functype/recommended"
|
|
52
|
+
import testOverrides from "eslint-config-functype/test-overrides"
|
|
53
|
+
import functype from "eslint-plugin-functype"
|
|
54
|
+
|
|
55
|
+
export default [recommended, functype.configs.recommended, testOverrides]
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-functype",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "Custom ESLint rules for functional TypeScript programming with functype library patterns including Do notation (ESLint 10+)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|