@putout/plugin-putout 29.27.0 β†’ 29.29.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 CHANGED
@@ -111,20 +111,26 @@ npm i @putout/plugin-putout -D
111
111
  ```json
112
112
  {
113
113
  "rules": {
114
- "putout/add-places-to-compare-places": "on",
115
- "putout/add-path-arg-to-fix": "on",
114
+ "putout/add-await-to-progress": "on",
115
+ "putout/add-crawl-file": "on",
116
116
  "putout/add-path-arg-to-filter": "on",
117
+ "putout/add-path-arg-to-fix": "on",
118
+
117
119
  "putout/add-path-arg-to-match": "on",
118
120
  "putout/add-path-arg-to-visitors": "on",
121
+ "putout/add-places-to-compare-places": "on",
122
+
119
123
  "putout/add-push-arg": "on",
120
124
  "putout/add-test-args": "on",
121
- "putout/add-traverse-args": "on",
122
- "putout/add-crawl-file": "on",
125
+
123
126
  "putout/add-track-file": "on",
124
- "putout/add-await-to-progress": "on",
127
+ "putout/add-traverse-args": "on",
128
+
125
129
  "putout/apply-async-formatter": "on",
126
- "putout/apply-create-test": "on",
130
+
127
131
  "putout/apply-create-nested-directory": "on",
132
+ "putout/apply-create-test": "on",
133
+
128
134
  "putout/apply-declare": "on",
129
135
  "putout/apply-destructuring": "on",
130
136
  "putout/apply-destructuring-to-options": "on",
@@ -133,71 +139,100 @@ npm i @putout/plugin-putout -D
133
139
  "putout/apply-exports-to-add-args": "on",
134
140
  "putout/apply-exports-to-match-files": "on",
135
141
  "putout/apply-exports-to-rename-files": "on",
142
+
143
+ "putout/apply-fixture-name-to-message": "on",
144
+ "putout/apply-for-of-to-track-file": "on",
136
145
  "putout/apply-get-binding": "on",
137
- "putout/apply-report": "on",
138
- "putout/apply-processors-destructuring": "on",
139
- "putout/apply-rename": "on",
146
+
147
+ "putout/apply-insert-after": "on",
148
+ "putout/apply-insert-before": "on",
149
+
150
+ "putout/apply-lowercase-to-node-builders": "on",
151
+ "putout/apply-name-to-is-identifier": "on",
152
+
153
+ "putout/apply-namespace-specifier": "on",
140
154
  "putout/apply-parens": "on",
155
+ "putout/apply-processors-destructuring": "on",
156
+
141
157
  "putout/apply-remove": "on",
158
+ "putout/apply-rename": "on",
159
+ "putout/apply-report": "on",
160
+
161
+ "putout/apply-short-processors": "on",
142
162
  "putout/apply-string-to-property-key": "on",
143
163
  "putout/apply-transform-with-options": "on",
144
- "putout/apply-insert-before": "on",
164
+
145
165
  "putout/apply-traverser-to-ignore": "on",
146
- "putout/apply-insert-after": "on",
166
+
147
167
  "putout/apply-vars": "on",
148
- "putout/apply-name-to-is-identifier": "on",
149
- "putout/apply-short-processors": "on",
150
- "putout/apply-lowercase-to-node-builders": "on",
151
- "putout/apply-namespace-specifier": "on",
152
- "putout/apply-for-of-to-track-file": "on",
153
- "putout/apply-fixture-name-to-message": "on",
154
- "putout/check-match": "on",
168
+
155
169
  "putout/check-declare": "on",
170
+ "putout/check-match": "on",
171
+
156
172
  "putout/check-replace-code": ["on", {
157
173
  "once": true
158
174
  }],
159
- "putout/convert-putout-test-to-create-test": "on",
160
- "putout/convert-to-no-transform-code": "on",
161
- "putout/convert-number-to-numeric": "on",
162
- "putout/convert-replace-with": "on",
163
- "putout/convert-replace-with-multiple": "on",
164
- "putout/convert-replace-to-function": "on",
165
- "putout/convert-replace-to-traverse": "on",
166
- "putout/convert-match-to-function": "on",
175
+
176
+ "putout/convert-add-argument-to-add-args": "on",
167
177
  "putout/convert-babel-types": "on",
168
178
  "putout/convert-destructuring-to-identifier": "on",
169
- "putout/convert-node-to-path-in-get-template-values": "on",
179
+
180
+ "putout/convert-dirname-to-url": "on",
181
+
182
+ "putout/convert-get-file-content-to-read-file-content": "on",
183
+ "putout/convert-get-rule-to-require": "on",
170
184
  "putout/convert-include-to-traverse": "on",
185
+ "putout/convert-match-to-function": "on",
186
+
187
+ "putout/convert-method-to-property": "on",
188
+ "putout/convert-node-to-path-in-get-template-values": "on",
189
+ "putout/convert-number-to-numeric": "on",
190
+
191
+ "putout/convert-plugins-element-to-tuple": "on",
192
+ "putout/convert-process-to-find": "on",
193
+
194
+ "putout/convert-progress-to-track-file": "on",
195
+
196
+ "putout/convert-push-object-to-push-path": "on",
197
+ "putout/convert-putout-test-to-create-test": "on",
198
+
199
+ "putout/convert-replace-to-function": "on",
200
+ "putout/convert-replace-to-traverse": "on",
201
+ "putout/convert-replace-with": "on",
202
+ "putout/convert-replace-with-multiple": "on",
203
+
204
+ "putout/convert-report-to-function": "on",
205
+ "putout/convert-to-no-transform-code": "on",
206
+
171
207
  "putout/convert-traverse-to-include": "on",
172
208
  "putout/convert-traverse-to-replace": "on",
173
209
  "putout/convert-traverse-to-scan": "on",
174
210
  "putout/convert-traverse-to-super-traverse": "on",
175
- "putout/convert-process-to-find": "on",
176
- "putout/convert-method-to-property": "on",
177
- "putout/convert-add-argument-to-add-args": "on",
178
- "putout/convert-dirname-to-url": "on",
211
+
179
212
  "putout/convert-url-to-dirname": "on",
180
- "putout/convert-report-to-function": "on",
181
- "putout/convert-get-rule-to-require": "on",
182
- "putout/convert-get-file-content-to-read-file-content": "on",
183
- "putout/convert-progress-to-track-file": "on",
184
- "putout/convert-plugins-element-to-tuple": "on",
185
- "putout/convert-push-object-to-push-path": "on",
213
+
186
214
  "putout/create-test": "on",
187
215
  "putout/declare": "on",
188
- "putout/declare-template-variables": "on",
216
+
189
217
  "putout/declare-path-variable": "on",
218
+ "putout/declare-template-variables": "on",
219
+
190
220
  "putout/includer": "on",
191
221
  "putout/move-require-on-top-level": "on",
192
- "putout/replace-test-message": "on",
193
- "putout/remove-unused-get-properties-argument": "on",
222
+
194
223
  "putout/remove-empty-array-from-process": "on",
195
224
  "putout/remove-empty-object-from-transform": "on",
225
+
226
+ "putout/remove-message-from-no-report-after-transform": "on",
227
+ "putout/remove-unused-get-properties-argument": "on",
228
+
196
229
  "putout/remove-useless-printer-option": "on",
197
230
  "putout/remove-useless-source-argument": "on",
198
- "putout/remove-message-from-no-report-after-transform": "on",
199
- "putout/simplify-replace-template": "on",
231
+ "putout/replace-test-message": "on",
232
+
200
233
  "putout/shorten-imports": "on",
234
+ "putout/simplify-replace-template": "on",
235
+
201
236
  "putout/sort-readme-file": "on"
202
237
  }
203
238
  }
@@ -2233,7 +2268,8 @@ Checkout in 🐊**Putout Editor**:
2233
2268
 
2234
2269
  - βœ… [`sort-contents`](https://putout.cloudcmd.io/#/gist/647bcc98ba9eeaa619dfa90d129ee0ec/a19ba868e8c2f97292e763675de65cc1ec98ff66);
2235
2270
  - βœ… [`sort-headings`](https://putout.cloudcmd.io/#/gist/a5a23310a84cb209e7e5537bab294ab2/0ecd88ffa6e37ac2553cabe5333d307aed2c4a7d);
2236
- - βœ… [`sort-readme-file`](https://putout.cloudcmd.io/#/gist/ac5f8b64383dabd025f38f177b18b5d2/09751fd2e6659445ed8d8d2102f1d23090a18f49);
2271
+ - βœ… [`sort-config`](https://putout.cloudcmd.io/#/gist/41c9975090803fdee30c445868e5b93f/18f78a72eb4f4cf33f5137fca11de9314c12763c);
2272
+ - βœ… [`sort-readme-file`](https://putout.cloudcmd.io/#/gist/41c9975090803fdee30c445868e5b93f/a5edcb99b4769c05d6482a051f918442bdcc86e9);
2237
2273
 
2238
2274
  ### ❌ Example of incorrect code
2239
2275
 
@@ -9,4 +9,5 @@ export default {
9
9
  __toml: 'const {__toml} = operator',
10
10
  __markdown: 'const {__markdown} = operator',
11
11
  __sql: 'const {__sql} = operator',
12
+ __css: 'const {__css} = operator',
12
13
  };
@@ -1,6 +1,7 @@
1
1
  import {operator} from 'putout';
2
2
  import * as sortContents from './sort-contents/index.js';
3
3
  import * as sortHeadings from './sort-headings/index.js';
4
+ import * as sortConfig from './sort-config/index.js';
4
5
 
5
6
  const {
6
7
  matchFiles,
@@ -17,6 +18,7 @@ export const {
17
18
  'README.md': {
18
19
  plugins: [
19
20
  ['sort-contents', sortContents],
21
+ ['sort-config', sortConfig],
20
22
  ['sort-headings', sortHeadings],
21
23
  ],
22
24
  },
@@ -0,0 +1,49 @@
1
+ import {operator, putout} from 'putout';
2
+
3
+ const {
4
+ extract,
5
+ toJS,
6
+ fromJS,
7
+ compare,
8
+ sortProperties,
9
+ } = operator;
10
+
11
+ export const report = () => `Sort 'Configuration'`;
12
+
13
+ export const match = () => ({
14
+ 'codeblock("json", __a)': (vars, path) => {
15
+ const prev = path.getPrevSibling();
16
+ return compare(prev, 'heading(2, "Config")');
17
+ },
18
+ });
19
+
20
+ export const replace = () => ({
21
+ 'codeblock("json", __a)': ({__a}) => {
22
+ const source = toJS(extract(__a));
23
+ const {code} = putout(source, {
24
+ plugins: [
25
+ ['sort-rules', sortProperties('rules')],
26
+ ],
27
+ });
28
+
29
+ const json = indent(fromJS(code)).trimEnd();
30
+
31
+ return `codeblock("json", \`${json}\n\`)`;
32
+ },
33
+ });
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-putout",
3
- "version": "29.27.0",
3
+ "version": "29.29.0",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout plugin helps with plugins development",