@putout/plugin-remove-duplicate-keys 7.0.0 → 8.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.
@@ -1,7 +1,5 @@
1
- 'use strict';
1
+ import {types, operator} from 'putout';
2
2
 
3
- const {types, operator} = require('putout');
4
- const fullstore = require('fullstore');
5
3
  const {
6
4
  compare,
7
5
  traverseProperties,
@@ -35,24 +33,17 @@ const isObjectPropertyLiteral = (value) => (a) => isObjectProperty(a) && isStrin
35
33
  value,
36
34
  });
37
35
 
38
- const store = fullstore([]);
36
+ export const report = () => 'Avoid duplicate keys';
39
37
 
40
- module.exports.report = () => 'Avoid duplicate keys';
38
+ export const fix = ({path, newProperties}) => {
39
+ path.node.properties = newProperties;
40
+ };
41
41
 
42
- module.exports.replace = () => ({
43
- __object: ({__object}) => {
44
- __object.properties = store();
45
- store([]);
46
-
47
- return __object;
48
- },
49
- });
50
-
51
- module.exports.match = () => ({
52
- __object: ({__object}, path) => {
42
+ export const traverse = ({push}) => ({
43
+ __object: (path) => {
53
44
  let is = false;
54
45
  const newProperties = [];
55
- const {properties} = __object;
46
+ const {properties} = path.node;
56
47
 
57
48
  const reversed = properties
58
49
  .slice()
@@ -126,9 +117,10 @@ module.exports.match = () => ({
126
117
  }
127
118
 
128
119
  if (is)
129
- store(newProperties);
130
-
131
- return is;
120
+ push({
121
+ path,
122
+ newProperties,
123
+ });
132
124
  },
133
125
  });
134
126
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@putout/plugin-remove-duplicate-keys",
3
- "version": "7.0.0",
4
- "type": "commonjs",
3
+ "version": "8.0.0",
4
+ "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout plugin adds ability to find and remove duplicate keys",
7
7
  "homepage": "https://github.com/coderaiser/putout/tree/master/packages/plugin-remove-duplicate-keys#readme",
@@ -23,9 +23,7 @@
23
23
  "coverage": "madrun coverage",
24
24
  "report": "madrun report"
25
25
  },
26
- "dependencies": {
27
- "fullstore": "^3.0.0"
28
- },
26
+ "dependencies": {},
29
27
  "keywords": [
30
28
  "putout",
31
29
  "putout-plugin",
@@ -35,21 +33,21 @@
35
33
  "key"
36
34
  ],
37
35
  "devDependencies": {
38
- "@putout/eslint-flat": "^2.0.0",
39
- "@putout/test": "^12.0.0",
36
+ "@putout/eslint-flat": "^3.0.0",
37
+ "@putout/test": "^13.0.0",
40
38
  "c8": "^10.0.0",
41
39
  "eslint": "^9.0.0",
42
40
  "eslint-plugin-n": "^17.0.0",
43
- "eslint-plugin-putout": "^25.0.1",
44
- "madrun": "^10.0.0",
41
+ "eslint-plugin-putout": "^27.0.0",
42
+ "madrun": "^11.0.0",
45
43
  "nodemon": "^3.0.1"
46
44
  },
47
45
  "peerDependencies": {
48
- "putout": ">=38"
46
+ "putout": ">=40"
49
47
  },
50
48
  "license": "MIT",
51
49
  "engines": {
52
- "node": ">=18"
50
+ "node": ">=20"
53
51
  },
54
52
  "publishConfig": {
55
53
  "access": "public"