@putout/plugin-putout-config 6.8.0 → 6.9.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
@@ -24,6 +24,7 @@ npm i @putout/plugin-putout-config -D
24
24
  - ✅ [convert-boolean-to-string][#convert-boolean-to-string];
25
25
  - ✅ [move-formatter-up][#move-formatter-up];
26
26
  - ✅ [remove-empty][#remove-empty];
27
+ - ✅ [remove-empty-file][#remove-empty-file];
27
28
  - ✅ [rename-property][#rename-property];
28
29
  - ✅ [rename-rules][#rename-rules];
29
30
 
@@ -43,6 +44,7 @@ npm i @putout/plugin-putout-config -D
43
44
  "putout-config/convert-boolean-to-string": "on",
44
45
  "putout-config/move-formatter-up": "on",
45
46
  "putout-config/remove-empty": "on",
47
+ "putout-config/remove-empty-file": "off",
46
48
  "putout-config/rename-rules": "on"
47
49
  }
48
50
  }
@@ -353,6 +355,23 @@ Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/48ce05b358
353
355
  }
354
356
  ```
355
357
 
358
+ ## remove-empty-file
359
+
360
+ Checkout in 🐊[**Putout Editor**](https://putout.vercel.app/#/gist/3d4878a71fe3fe5a2676b2f1380bad2e/071b8db5c4c8e00f73b2d6d3ded040d0d64d2977).
361
+ When `.putout.json` content is:
362
+
363
+ ```js
364
+ {}
365
+ ```
366
+
367
+ It has no sense and removed:
368
+
369
+ ```diff
370
+ /
371
+ `-- /
372
+ - `-- .putout.json
373
+ ```
374
+
356
375
  ## rename-rules
357
376
 
358
377
  Rename rules according to:
package/lib/index.js CHANGED
@@ -12,6 +12,7 @@ const convertBooleanToString = require('./convert-boolean-to-string');
12
12
  const renameRules = require('./rename-rules');
13
13
  const removeEmpty = require('./remove-empty');
14
14
  const MoveFormatterUp = require('./move-formatter-up');
15
+ const removeEmptyFile = require('./remove-empty-file');
15
16
 
16
17
  module.exports.rules = {
17
18
  'apply-conditions': applyConditions,
@@ -26,4 +27,5 @@ module.exports.rules = {
26
27
  'move-formatter-up': MoveFormatterUp,
27
28
  'rename-rules': renameRules,
28
29
  'remove-empty': removeEmpty,
30
+ 'remove-empty-file': ['off', removeEmptyFile],
29
31
  };
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ const {operator} = require('putout');
4
+ const {
5
+ readFileContent,
6
+ findFile,
7
+ removeFile,
8
+ } = operator;
9
+
10
+ module.exports.report = () => `Remove empty '.putout.json'`;
11
+
12
+ module.exports.fix = (filePath) => {
13
+ removeFile(filePath);
14
+ };
15
+
16
+ module.exports.scan = (path, {push}) => {
17
+ for (const file of findFile(path, '.putout.json')) {
18
+ const data = readFileContent(file);
19
+
20
+ if (data === '{}')
21
+ push(file);
22
+ }
23
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-putout-config",
3
- "version": "6.8.0",
3
+ "version": "6.9.1",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout plugin helps to maintain putout config",