@putout/plugin-putout 29.34.1 → 29.35.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 +19 -1
- package/lib/index.js +2 -0
- package/lib/shorten-path-get/index.js +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -105,6 +105,7 @@ npm i @putout/plugin-putout -D
|
|
|
105
105
|
- ✅ [convert-replacer-to-includer](#convert-replacer-to-includer);
|
|
106
106
|
- ✅ [remove-useless-match](#remove-useless-match);
|
|
107
107
|
- ✅ [remove-useless-type-check-declaration](#remove-useless-type-check-declaration);
|
|
108
|
+
- ✅ [shorten-path-get](#shorten-path-get);
|
|
108
109
|
|
|
109
110
|
## File rules
|
|
110
111
|
|
|
@@ -206,7 +207,8 @@ npm i @putout/plugin-putout -D
|
|
|
206
207
|
"putout/sort-readme-file": "on",
|
|
207
208
|
"putout/convert-replacer-to-includer": "on",
|
|
208
209
|
"putout/remove-useless-match": "on",
|
|
209
|
-
"putout/remove-useless-type-check-declaration": "on"
|
|
210
|
+
"putout/remove-useless-type-check-declaration": "on",
|
|
211
|
+
"putout/shorten-path-get": "on"
|
|
210
212
|
}
|
|
211
213
|
}
|
|
212
214
|
```
|
|
@@ -2336,6 +2338,22 @@ const isStringLiteral = (arg) => arg.type === 'StringLiteral';
|
|
|
2336
2338
|
```js
|
|
2337
2339
|
```
|
|
2338
2340
|
|
|
2341
|
+
## shorten-path-get
|
|
2342
|
+
|
|
2343
|
+
Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/afc8a421eee129910153939eae2eb79e/04304530529a53f5894a289bcd83d3ac2460c9ab).
|
|
2344
|
+
|
|
2345
|
+
### ❌ Example of incorrect code
|
|
2346
|
+
|
|
2347
|
+
```js
|
|
2348
|
+
const elements = path.get('arguments')[0].get('elements');
|
|
2349
|
+
```
|
|
2350
|
+
|
|
2351
|
+
### ✅ Example of correct code
|
|
2352
|
+
|
|
2353
|
+
```js
|
|
2354
|
+
const elements = path.get('arguments.0.elements');
|
|
2355
|
+
```
|
|
2356
|
+
|
|
2339
2357
|
## License
|
|
2340
2358
|
|
|
2341
2359
|
MIT
|
package/lib/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as shortenPathGet from './shorten-path-get/index.js';
|
|
1
2
|
import * as removeUselessTypeCheckDeclaration from './remove-useless-type-check-declaration/index.js';
|
|
2
3
|
import * as removeUselessMatch from './remove-useless-match/index.js';
|
|
3
4
|
import * as convertReplacerToIncluder from './convert-replacer-to-includer/index.js';
|
|
@@ -186,4 +187,5 @@ export const rules = {
|
|
|
186
187
|
'convert-replacer-to-includer': convertReplacerToIncluder,
|
|
187
188
|
'remove-useless-match': removeUselessMatch,
|
|
188
189
|
'remove-useless-type-check-declaration': removeUselessTypeCheckDeclaration,
|
|
190
|
+
'shorten-path-get': shortenPathGet,
|
|
189
191
|
};
|
package/package.json
CHANGED