Skip to content

Commit aa014b6

Browse files
committed
feature: @putout/plugin-split-nested-destructuring: migrate to ESM
1 parent 902fa6e commit aa014b6

File tree

5 files changed

+10
-13
lines changed

5 files changed

+10
-13
lines changed

packages/plugin-split-nested-destructuring/.madrun.mjs renamed to packages/plugin-split-nested-destructuring/.madrun.js

File renamed without changes.

packages/plugin-split-nested-destructuring/eslint.config.mjs renamed to packages/plugin-split-nested-destructuring/eslint.config.js

File renamed without changes.

packages/plugin-split-nested-destructuring/lib/split-nested-destructuring.js

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

3-
const {types, template} = require('putout');
43
const {
54
objectProperty,
65
isObjectPattern,
@@ -11,14 +10,14 @@ const buildDeclaration = template(`
1110
const %%__b%% = %%__a%%
1211
`);
1312

14-
module.exports.report = () => 'Avoid nested destructuring';
13+
export const report = () => 'Avoid nested destructuring';
1514

16-
module.exports.match = () => ({
15+
export const match = () => ({
1716
'const {__a: {__b}} = __c': matchConst,
1817
'const {__a: {__b: __c}} = __d': matchConst,
1918
});
2019

21-
module.exports.replace = () => ({
20+
export const replace = () => ({
2221
'const {__a: {__b}} = __c': 'const {__a} = __c, {__b} = __a',
2322
'const {__a: {__b: __c}} = __d': 'const {__a} = __d, {__b: __c} = __a',
2423
'const {__a: {__b = __c}} = __d': 'const {__a} = __d, {__b = __c} = __a',

packages/plugin-split-nested-destructuring/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-split-nested-destructuring",
33
"version": "3.0.0",
4-
"type": "commonjs",
4+
"type": "module",
55
"author": "coderaiser <[email protected]> (https://github.com/coderaiser)",
66
"description": "🐊Putout plugin adds ability to split nested destructuring",
77
"homepage": "https://github.com/coderaiser/putout/tree/master/packages/plugin-split-nested-destructuring#readme",
@@ -42,11 +42,11 @@
4242
"nodemon": "^3.0.1"
4343
},
4444
"peerDependencies": {
45-
"putout": ">=29"
45+
"putout": ">=40"
4646
},
4747
"license": "MIT",
4848
"engines": {
49-
"node": ">=16"
49+
"node": ">=20"
5050
},
5151
"publishConfig": {
5252
"access": "public"

packages/plugin-split-nested-destructuring/test/split-nested-destructuring.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
'use strict';
1+
import {createTest} from '@putout/test';
2+
import * as splitDestructuring from '../lib/split-nested-destructuring.js';
23

3-
const {createTest} = require('@putout/test');
4-
const splitDestructuring = require('..');
5-
6-
const test = createTest(__dirname, {
4+
const test = createTest(import.meta.url, {
75
plugins: [
86
['split-destructuring', splitDestructuring],
97
],

0 commit comments

Comments
 (0)