@putout/plugin-putout-config 2.0.0 β 4.0.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 +5 -5
- package/lib/convert-boolean-to-string/index.js +3 -5
- package/lib/index.js +4 -6
- package/lib/remove-empty/index.js +9 -3
- package/package.json +12 -11
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-putout-config.svg?style=flat&longCache=true
|
|
4
4
|
[NPMURL]: https://npmjs.org/package/@putout/plugin-putout-config"npm"
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
π[**Putout**](https://github.com/coderaiser/putout) plugin helps with π[**Putout Config**](https://github.com/coderaiser/putout#-configuration).
|
|
7
7
|
|
|
8
8
|
## Install
|
|
9
9
|
|
|
@@ -24,7 +24,7 @@ npm i @putout/plugin-putout-config -D
|
|
|
24
24
|
|
|
25
25
|
## convert-boolean-to-string
|
|
26
26
|
|
|
27
|
-
### β
|
|
27
|
+
### β Example of incorrect code
|
|
28
28
|
|
|
29
29
|
```json
|
|
30
30
|
{
|
|
@@ -35,7 +35,7 @@ npm i @putout/plugin-putout-config -D
|
|
|
35
35
|
}
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
### β
|
|
38
|
+
### β
Example of correct code
|
|
39
39
|
|
|
40
40
|
```json
|
|
41
41
|
{
|
|
@@ -48,7 +48,7 @@ npm i @putout/plugin-putout-config -D
|
|
|
48
48
|
|
|
49
49
|
## remove-empty
|
|
50
50
|
|
|
51
|
-
### β
|
|
51
|
+
### β Example of incorrect code
|
|
52
52
|
|
|
53
53
|
```json
|
|
54
54
|
{
|
|
@@ -62,7 +62,7 @@ npm i @putout/plugin-putout-config -D
|
|
|
62
62
|
}
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
### β
|
|
65
|
+
### β
Example of correct code
|
|
66
66
|
|
|
67
67
|
```json
|
|
68
68
|
{
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const {
|
|
4
|
-
types,
|
|
5
|
-
operator,
|
|
6
|
-
} = require('putout');
|
|
3
|
+
const {types, operator} = require('putout');
|
|
7
4
|
|
|
8
5
|
const {replaceWith} = operator;
|
|
9
6
|
const {StringLiteral} = types;
|
|
10
7
|
|
|
11
|
-
module.exports.report = () => 'String
|
|
8
|
+
module.exports.report = () => `Use 'String (on/off)' instead of 'Boolean (true/false)'`;
|
|
12
9
|
|
|
13
10
|
module.exports.fix = (path) => {
|
|
14
11
|
const {value} = path.node;
|
|
@@ -20,6 +17,7 @@ module.exports.fix = (path) => {
|
|
|
20
17
|
module.exports.traverse = ({push}) => ({
|
|
21
18
|
'__putout_processor_json(__a)'(path) {
|
|
22
19
|
const objectPath = path.get('arguments.0');
|
|
20
|
+
|
|
23
21
|
const propPaths = [
|
|
24
22
|
...getProperties('rules', objectPath),
|
|
25
23
|
...getMatchProperties(objectPath),
|
package/lib/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
});
|
|
3
|
+
const convertBooleanToString = require('./convert-boolean-to-string');
|
|
4
|
+
const removeEmpty = require('./remove-empty');
|
|
6
5
|
|
|
7
6
|
module.exports.rules = {
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
'convert-boolean-to-string': convertBooleanToString,
|
|
8
|
+
'remove-empty': removeEmpty,
|
|
10
9
|
};
|
|
11
|
-
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const {operator} = require('putout');
|
|
4
|
+
const {remove} = operator;
|
|
5
|
+
|
|
3
6
|
module.exports.report = () => 'Avoid empty property values';
|
|
4
7
|
|
|
5
8
|
module.exports.fix = (path) => {
|
|
6
|
-
path.parentPath
|
|
9
|
+
remove(path.parentPath);
|
|
7
10
|
};
|
|
8
11
|
|
|
9
|
-
module.exports.include = () => [
|
|
12
|
+
module.exports.include = () => [
|
|
13
|
+
'ObjectExpression',
|
|
14
|
+
'ArrayExpression',
|
|
15
|
+
];
|
|
10
16
|
module.exports.filter = (path) => {
|
|
11
17
|
const {parentPath, node} = path;
|
|
18
|
+
|
|
12
19
|
const {properties, elements} = node;
|
|
13
20
|
|
|
14
21
|
if (!parentPath.isObjectProperty())
|
|
@@ -24,4 +31,3 @@ module.exports.filter = (path) => {
|
|
|
24
31
|
|
|
25
32
|
return !elements.length;
|
|
26
33
|
};
|
|
27
|
-
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-putout-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
|
+
"type": "commonjs",
|
|
4
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
5
|
-
"description": "
|
|
6
|
+
"description": "πPutout plugin helps to maintain putout config",
|
|
6
7
|
"homepage": "https://github.com/coderaiser/putout/tree/master/packages/plugin-putout-config#readme",
|
|
7
8
|
"main": "lib/index.js",
|
|
8
9
|
"release": false,
|
|
@@ -31,21 +32,21 @@
|
|
|
31
32
|
"config"
|
|
32
33
|
],
|
|
33
34
|
"devDependencies": {
|
|
34
|
-
"@putout/test": "^
|
|
35
|
-
"c8": "^
|
|
35
|
+
"@putout/test": "^7.0.0",
|
|
36
|
+
"c8": "^8.0.0",
|
|
36
37
|
"eslint": "^8.0.1",
|
|
37
|
-
"eslint-plugin-
|
|
38
|
-
"eslint-plugin-putout": "^
|
|
39
|
-
"lerna": "^
|
|
40
|
-
"madrun": "^
|
|
41
|
-
"nodemon": "^
|
|
38
|
+
"eslint-plugin-n": "^16.0.0",
|
|
39
|
+
"eslint-plugin-putout": "^21.0.0",
|
|
40
|
+
"lerna": "^6.0.1",
|
|
41
|
+
"madrun": "^9.0.0",
|
|
42
|
+
"nodemon": "^3.0.1"
|
|
42
43
|
},
|
|
43
44
|
"peerDependencies": {
|
|
44
|
-
"putout": ">=
|
|
45
|
+
"putout": ">=32"
|
|
45
46
|
},
|
|
46
47
|
"license": "MIT",
|
|
47
48
|
"engines": {
|
|
48
|
-
"node": ">=
|
|
49
|
+
"node": ">=16"
|
|
49
50
|
},
|
|
50
51
|
"publishConfig": {
|
|
51
52
|
"access": "public"
|