eslint-plugin-putout 25.0.4 → 25.1.0
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 +42 -1
- package/lib/index.mjs +1 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,7 +17,32 @@ npm i putout eslint eslint-plugin-putout -D
|
|
|
17
17
|
|
|
18
18
|
## Usage
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
### Plugin
|
|
21
|
+
|
|
22
|
+
To use `putout` as ESLint plugin you can use in `eslint.config.js`
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
import putout from 'eslint-plugin-putout';
|
|
26
|
+
|
|
27
|
+
export default [
|
|
28
|
+
rules: {
|
|
29
|
+
'putout/putout': 'error',
|
|
30
|
+
},
|
|
31
|
+
plugins: {
|
|
32
|
+
putout,
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Preset
|
|
38
|
+
|
|
39
|
+
Also you can import one of predefined preset:
|
|
40
|
+
|
|
41
|
+
- ✅ **recommended** - all rules enabled;
|
|
42
|
+
- ✅ **safe** - dangerous rules disabled;
|
|
43
|
+
- ✅ **safeAlign** - dangerous rules disabled + add whitespaces on empty lines;
|
|
44
|
+
|
|
45
|
+
Here is how it can look like:
|
|
21
46
|
|
|
22
47
|
```js
|
|
23
48
|
import {recommended} from 'eslint-plugin-putout';
|
|
@@ -25,6 +50,22 @@ import {recommended} from 'eslint-plugin-putout';
|
|
|
25
50
|
export default recommended;
|
|
26
51
|
```
|
|
27
52
|
|
|
53
|
+
Or with [`defineConfig`](https://eslint.org/blog/2025/03/flat-config-extends-define-config-global-ignores/):
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
import {defineConfig} from 'eslint/config';
|
|
57
|
+
import putout from 'eslint-plugin-putout';
|
|
58
|
+
|
|
59
|
+
export default defineConfig({
|
|
60
|
+
plugins: {
|
|
61
|
+
putout,
|
|
62
|
+
},
|
|
63
|
+
extends: [
|
|
64
|
+
"putout/recommended",
|
|
65
|
+
]
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
28
69
|
Then configure the rules you want to use under the rules section.
|
|
29
70
|
|
|
30
71
|
```json
|
package/lib/index.mjs
CHANGED