Skip to content

Commit 94d163a

Browse files
committed
feature: @putout/plugin-merge-duplicate-functions: convert to ESM
1 parent 32f1e45 commit 94d163a

File tree

5 files changed

+10
-14
lines changed

5 files changed

+10
-14
lines changed
File renamed without changes.

packages/plugin-merge-duplicate-functions/eslint.config.mjs renamed to packages/plugin-merge-duplicate-functions/eslint.config.js

File renamed without changes.

packages/plugin-merge-duplicate-functions/lib/merge-duplicate-functions.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
'use strict';
1+
import {operator} from 'putout';
22

3-
const {operator} = require('putout');
43
const {
54
compare,
65
remove,
@@ -9,17 +8,17 @@ const {
98

109
const {entries, keys} = Object;
1110

12-
module.exports.report = () => 'Avoid duplicate functions';
11+
export const report = () => 'Avoid duplicate functions';
1312

14-
module.exports.fix = ({path, duplicatePath}) => {
13+
export const fix = ({path, duplicatePath}) => {
1514
const {name} = path.get('id').node;
1615
const {name: duplicateName} = duplicatePath.get('id').node;
1716

1817
rename(path, duplicateName, name);
1918
remove(duplicatePath);
2019
};
2120

22-
module.exports.traverse = ({push}) => ({
21+
export const traverse = ({push}) => ({
2322
Program({scope}) {
2423
const {bindings} = scope;
2524
const names = keys(bindings);

packages/plugin-merge-duplicate-functions/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@putout/plugin-merge-duplicate-functions",
33
"version": "2.0.0",
4-
"type": "commonjs",
4+
"type": "module",
55
"author": "coderaiser <[email protected]> (https://github.com/coderaiser)",
66
"description": "🐊Putout plugin adds ability to merge duplicate functions",
77
"homepage": "https://github.com/coderaiser/putout/tree/master/packages/plugin-merge-duplicate-functions#readme",
@@ -44,11 +44,11 @@
4444
"nodemon": "^3.0.1"
4545
},
4646
"peerDependencies": {
47-
"putout": ">=32"
47+
"putout": ">=39"
4848
},
4949
"license": "MIT",
5050
"engines": {
51-
"node": ">=16"
51+
"node": ">=20"
5252
},
5353
"publishConfig": {
5454
"access": "public"

packages/plugin-merge-duplicate-functions/test/merge-duplicate-functions.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
'use strict';
1+
import {createTest} from '@putout/test';
2+
import * as plugin from '../lib/merge-duplicate-functions.js';
23

3-
const {createTest} = require('@putout/test');
4-
5-
const plugin = require('..');
6-
7-
const test = createTest(__dirname, {
4+
const test = createTest(import.meta.url, {
85
plugins: [
96
['merge-duplicate-functions', plugin],
107
],

0 commit comments

Comments
 (0)