Skip to content

Commit d4c8be5

Browse files
committed
feature: @putout/plugin-apply-arrow: migrate to ESM
1 parent d650690 commit d4c8be5

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

packages/plugin-apply-arrow/.putout.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@
44
"apply-arrow": "off",
55
"putout/check-replace-code": "off"
66
}
7+
},
8+
"rules": {
9+
"apply-arrow": "off"
710
}
8-
}
11+
}
File renamed without changes.

packages/plugin-apply-arrow/lib/apply-arrow.js

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

3-
const {print, types} = require('putout');
43
const {
54
isFunction,
65
isProgram,
@@ -11,9 +10,9 @@ const {
1110

1211
const isTopScope = (a) => isFunction(a) || isProgram(a);
1312

14-
module.exports.report = () => `Use 'Arrow Function' instead of 'Function Declaration`;
13+
export const report = () => `Use 'Arrow Function' instead of 'Function Declaration`;
1514

16-
module.exports.match = ({options}) => ({
15+
export const match = ({options}) => ({
1716
'function __a(__args) {return __b}': ({__a, __b}, path) => {
1817
const {maxSize = 30} = options;
1918

@@ -45,7 +44,7 @@ module.exports.match = ({options}) => ({
4544
},
4645
});
4746

48-
module.exports.replace = () => ({
47+
export const replace = () => ({
4948
'function __a(__args) {return __b}': 'const __a = (__args) => __b',
5049
});
5150

packages/plugin-apply-arrow/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-apply-arrow",
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 convert Function Declaration to Arrow Function",
77
"homepage": "https://github.com/coderaiser/putout/tree/master/packages/plugin-apply-arrow#readme",
@@ -41,11 +41,11 @@
4141
"nodemon": "^3.0.1"
4242
},
4343
"peerDependencies": {
44-
"putout": ">=38"
44+
"putout": ">=40"
4545
},
4646
"license": "MIT",
4747
"engines": {
48-
"node": ">=18"
48+
"node": ">=20"
4949
},
5050
"publishConfig": {
5151
"access": "public"

packages/plugin-apply-arrow/test/apply-arrow.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
'use strict';
1+
import {createTest} from '@putout/test';
2+
import {operator} from 'putout';
3+
import * as plugin from '../lib/apply-arrow.js';
24

3-
const {createTest} = require('@putout/test');
4-
const {operator} = require('putout');
5-
6-
const plugin = require('..');
75
const {
86
compare,
97
getTemplateValues,
108
} = operator;
119

12-
const test = createTest(__dirname, {
10+
const test = createTest(import.meta.url, {
1311
plugins: [
1412
['apply-arrow', plugin],
1513
],

0 commit comments

Comments
 (0)