@putout/plugin-package-json 5.0.0 β†’ 6.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 CHANGED
@@ -87,6 +87,7 @@ File `.nycrc.json`:
87
87
  ## remove-commit-type
88
88
 
89
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).
90
91
 
91
92
  ```diff
92
93
  {
@@ -1,21 +1,19 @@
1
1
  'use strict';
2
2
 
3
- const {
4
- operator,
5
- types,
6
- } = require('putout');
3
+ const {operator, types} = require('putout');
7
4
 
8
- const {
9
- ObjectProperty,
10
- StringLiteral,
11
- } = types;
5
+ const {ObjectProperty, StringLiteral} = types;
12
6
 
13
- const {getProperties} = operator;
7
+ const {
8
+ getProperties,
9
+ insertAfter,
10
+ __json,
11
+ } = operator;
14
12
 
15
13
  module.exports.report = () => `Add 'type' of module to 'package.json'`;
16
14
 
17
15
  module.exports.traverse = ({push}) => ({
18
- '__putout_processor_json(__a)': (path) => {
16
+ [__json]: (path) => {
19
17
  const __aPath = path.get('arguments.0');
20
18
  const {versionPath, typePath} = getProperties(__aPath, ['version', 'type']);
21
19
 
@@ -31,6 +29,5 @@ module.exports.traverse = ({push}) => ({
31
29
 
32
30
  module.exports.fix = (path) => {
33
31
  const node = ObjectProperty(StringLiteral('type'), StringLiteral('commonjs'));
34
- path.insertAfter(node);
32
+ insertAfter(path, node);
35
33
  };
36
-
package/lib/index.js CHANGED
@@ -1,12 +1,11 @@
1
1
  'use strict';
2
2
 
3
- const getRule = (a) => ({
4
- [a]: require(`./${a}`),
5
- });
3
+ const addType = require('./add-type');
4
+ const removeNyc = require('./remove-nyc');
5
+ const removeCommitType = require('./remove-commit-type');
6
6
 
7
7
  module.exports.rules = {
8
- ...getRule('add-type'),
9
- ...getRule('remove-nyc'),
10
- ...getRule('remove-commit-type'),
8
+ 'add-type': addType,
9
+ 'remove-nyc': removeNyc,
10
+ 'remove-commit-type': removeCommitType,
11
11
  };
12
-
@@ -4,6 +4,7 @@ const {operator} = require('putout');
4
4
  const {
5
5
  getProperties,
6
6
  remove,
7
+ __json,
7
8
  } = operator;
8
9
 
9
10
  module.exports.report = () => `Remove 'commitType=colon' field of 'package.json', it is 'colon' by default`;
@@ -13,7 +14,7 @@ module.exports.fix = (path) => {
13
14
  };
14
15
 
15
16
  module.exports.traverse = ({push}) => ({
16
- '__putout_processor_json(__a)': (path) => {
17
+ [__json]: (path) => {
17
18
  const __aPath = path.get('arguments.0');
18
19
  const {commitTypePath} = getProperties(__aPath, ['commitType']);
19
20
 
@@ -4,6 +4,7 @@ const {operator} = require('putout');
4
4
  const {
5
5
  remove,
6
6
  getProperties,
7
+ __json,
7
8
  } = operator;
8
9
 
9
10
  module.exports.report = () => `Remove 'nyc' section of 'package.json', use file '.nycrc.json' instead`;
@@ -13,7 +14,7 @@ module.exports.fix = (path) => {
13
14
  };
14
15
 
15
16
  module.exports.traverse = ({push}) => ({
16
- '__putout_processor_json(__a)': (path) => {
17
+ [__json]: (path) => {
17
18
  const __aPath = path.get('arguments.0');
18
19
  const {nycPath} = getProperties(__aPath, ['nyc']);
19
20
 
@@ -23,4 +24,3 @@ module.exports.traverse = ({push}) => ({
23
24
  push(nycPath);
24
25
  },
25
26
  });
26
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-package-json",
3
- "version": "5.0.0",
3
+ "version": "6.0.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout plugin for package.json",
@@ -31,17 +31,17 @@
31
31
  "package-json"
32
32
  ],
33
33
  "devDependencies": {
34
- "@putout/test": "^5.0.0",
35
- "c8": "^7.5.0",
34
+ "@putout/test": "^7.0.0",
35
+ "c8": "^8.0.0",
36
36
  "eslint": "^8.0.1",
37
- "eslint-plugin-n": "^15.2.4",
38
- "eslint-plugin-putout": "^16.0.0",
37
+ "eslint-plugin-n": "^16.0.0",
38
+ "eslint-plugin-putout": "^21.0.0",
39
39
  "lerna": "^6.0.1",
40
40
  "madrun": "^9.0.0",
41
- "nodemon": "^2.0.1"
41
+ "nodemon": "^3.0.1"
42
42
  },
43
43
  "peerDependencies": {
44
- "putout": ">=29"
44
+ "putout": ">=33"
45
45
  },
46
46
  "license": "MIT",
47
47
  "engines": {