@putout/plugin-package-json 4.1.0 β†’ 5.0.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
@@ -16,12 +16,25 @@ npm i @putout/plugin-package-json -D
16
16
  ```json
17
17
  {
18
18
  "rules": {
19
+ "package-json/add-type": "on",
19
20
  "package-json/remove-nyc": "on",
20
- "package-json/add-type": "on"
21
+ "package-json/remove-commit-type": "on"
21
22
  }
22
23
  }
23
24
  ```
24
25
 
26
+ ## add-type
27
+
28
+ Add [`type`](https://nodejs.org/dist/latest-v17.x/docs/api/packages.html#type) field to `package.json`:
29
+
30
+ ```diff
31
+ {
32
+ "name": "hello",
33
+ "version": "1.0.0",
34
+ + "type": "commonjs"
35
+ }
36
+ ```
37
+
25
38
  ## remove-nyc
26
39
 
27
40
  - additional fields in `package.json` produces more traffic then users of your package really need;
@@ -71,15 +84,16 @@ File `.nycrc.json`:
71
84
  }
72
85
  ```
73
86
 
74
- ## add-type
87
+ ## remove-commit-type
75
88
 
76
- Add [`type`](https://nodejs.org/dist/latest-v17.x/docs/api/packages.html#type) field to `package.json`:
89
+ Since 🎁**Wisdom** [v14](https://github.com/coderaiser/wisdom/releases/tag/v14.0.0) `commitType` set to `colon` be default, so it can be dropped from `package.json` if it's value not `paren`:
90
+ Check out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/eb12c902c8e99effc91ae44119d625d7/8e60d60b2c2e7bb28ca5b2eba61715a062ac5319).
77
91
 
78
92
  ```diff
79
93
  {
80
94
  "name": "hello",
81
95
  "version": "1.0.0",
82
- + "type": "commonjs"
96
+ "commitType": "colon"
83
97
  }
84
98
  ```
85
99
 
package/lib/index.js CHANGED
@@ -5,7 +5,8 @@ const getRule = (a) => ({
5
5
  });
6
6
 
7
7
  module.exports.rules = {
8
- ...getRule('remove-nyc'),
9
8
  ...getRule('add-type'),
9
+ ...getRule('remove-nyc'),
10
+ ...getRule('remove-commit-type'),
10
11
  };
11
12
 
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ const {operator} = require('putout');
4
+ const {
5
+ getProperties,
6
+ remove,
7
+ } = operator;
8
+
9
+ module.exports.report = () => `Remove 'commitType=colon' field of 'package.json', it is 'colon' by default`;
10
+
11
+ module.exports.fix = (path) => {
12
+ remove(path);
13
+ };
14
+
15
+ module.exports.traverse = ({push}) => ({
16
+ '__putout_processor_json(__a)': (path) => {
17
+ const __aPath = path.get('arguments.0');
18
+ const {commitTypePath} = getProperties(__aPath, ['commitType']);
19
+
20
+ if (!commitTypePath)
21
+ return;
22
+
23
+ if (commitTypePath.get('value').isStringLiteral({value: 'paren'}))
24
+ return;
25
+
26
+ push(commitTypePath);
27
+ },
28
+ });
@@ -6,7 +6,7 @@ const {
6
6
  getProperties,
7
7
  } = operator;
8
8
 
9
- module.exports.report = () => `Remove 'nyc' section of 'package.json', use file '.nycrc.json' intead`;
9
+ module.exports.report = () => `Remove 'nyc' section of 'package.json', use file '.nycrc.json' instead`;
10
10
 
11
11
  module.exports.fix = (path) => {
12
12
  remove(path);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-package-json",
3
- "version": "4.1.0",
3
+ "version": "5.0.1",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout plugin for package.json",
@@ -34,14 +34,14 @@
34
34
  "@putout/test": "^5.0.0",
35
35
  "c8": "^7.5.0",
36
36
  "eslint": "^8.0.1",
37
- "eslint-plugin-node": "^11.0.0",
38
- "eslint-plugin-putout": "^14.0.0",
39
- "lerna": "^4.0.0",
37
+ "eslint-plugin-n": "^15.2.4",
38
+ "eslint-plugin-putout": "^16.0.0",
39
+ "lerna": "^6.0.1",
40
40
  "madrun": "^9.0.0",
41
41
  "nodemon": "^2.0.1"
42
42
  },
43
43
  "peerDependencies": {
44
- "putout": ">=25"
44
+ "putout": ">=29"
45
45
  },
46
46
  "license": "MIT",
47
47
  "engines": {