@putout/plugin-putout 29.29.0 β 29.30.1
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
CHANGED
|
@@ -2271,28 +2271,6 @@ Checkout in π**Putout Editor**:
|
|
|
2271
2271
|
- β
[`sort-config`](https://putout.cloudcmd.io/#/gist/41c9975090803fdee30c445868e5b93f/18f78a72eb4f4cf33f5137fca11de9314c12763c);
|
|
2272
2272
|
- β
[`sort-readme-file`](https://putout.cloudcmd.io/#/gist/41c9975090803fdee30c445868e5b93f/a5edcb99b4769c05d6482a051f918442bdcc86e9);
|
|
2273
2273
|
|
|
2274
|
-
### β Example of incorrect code
|
|
2275
|
-
|
|
2276
|
-
```js
|
|
2277
|
-
import {tryCatch} from 'try-catch';
|
|
2278
|
-
|
|
2279
|
-
transform(ast, source, options);
|
|
2280
|
-
findPlaces(ast, source, options);
|
|
2281
|
-
tryCatch(transform, ast, source, {});
|
|
2282
|
-
tryCatch(findPlaces, ast, source, resultOptions);
|
|
2283
|
-
```
|
|
2284
|
-
|
|
2285
|
-
### β
Example of correct code
|
|
2286
|
-
|
|
2287
|
-
```js
|
|
2288
|
-
import {tryCatch} from 'try-catch';
|
|
2289
|
-
|
|
2290
|
-
transform(ast, options);
|
|
2291
|
-
findPlaces(ast, options);
|
|
2292
|
-
tryCatch(transform, ast, {});
|
|
2293
|
-
tryCatch(findPlaces, ast, resultOptions);
|
|
2294
|
-
```
|
|
2295
|
-
|
|
2296
2274
|
## apply-fixture-name-to-message"
|
|
2297
2275
|
|
|
2298
2276
|
Checkout in π[**Putout Editor**](https://putout.cloudcmd.io/#/gist/66eb493ee966c2465a9fc783cd3ca362/f42ec60e393181b6d6aaf6df81640e93fabe8783).
|
|
@@ -5,6 +5,7 @@ import jsx from './jsx.js';
|
|
|
5
5
|
import keyword from './keyword.js';
|
|
6
6
|
import parens from './parens.js';
|
|
7
7
|
import regexp from './regexp.js';
|
|
8
|
+
import markdown from './markdown.js';
|
|
8
9
|
import creators from './creators.json' with {
|
|
9
10
|
type: 'json',
|
|
10
11
|
};
|
|
@@ -18,6 +19,7 @@ export default {
|
|
|
18
19
|
...keyword,
|
|
19
20
|
...parens,
|
|
20
21
|
...regexp,
|
|
22
|
+
...markdown,
|
|
21
23
|
operator: `import {operator} from 'putout'`,
|
|
22
24
|
compare: 'const {compare} = operator',
|
|
23
25
|
compareAll: 'const {compareAll} = operator',
|
|
@@ -6,6 +6,7 @@ const {
|
|
|
6
6
|
fromJS,
|
|
7
7
|
compare,
|
|
8
8
|
sortProperties,
|
|
9
|
+
indentCodeblock,
|
|
9
10
|
} = operator;
|
|
10
11
|
|
|
11
12
|
export const report = () => `Sort 'Configuration'`;
|
|
@@ -26,24 +27,8 @@ export const replace = () => ({
|
|
|
26
27
|
],
|
|
27
28
|
});
|
|
28
29
|
|
|
29
|
-
const json =
|
|
30
|
+
const json = indentCodeblock(fromJS(code)).trimEnd();
|
|
30
31
|
|
|
31
32
|
return `codeblock("json", \`${json}\n\`)`;
|
|
32
33
|
},
|
|
33
34
|
});
|
|
34
|
-
|
|
35
|
-
const indent = (a, prefixCount = 4) => {
|
|
36
|
-
const lines = a.split('\n');
|
|
37
|
-
const result = [''];
|
|
38
|
-
|
|
39
|
-
const prefix = ' '.repeat(prefixCount * 2);
|
|
40
|
-
const suffix = ' '.repeat(prefixCount);
|
|
41
|
-
|
|
42
|
-
for (const line of lines) {
|
|
43
|
-
result.push(`${prefix}${line}`);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
result.push(suffix);
|
|
47
|
-
|
|
48
|
-
return result.join('\n');
|
|
49
|
-
};
|
package/package.json
CHANGED