Skip to content

Commit ea21d12

Browse files
committed
feature: @putout/plugin-madrun: drop support of node < 20
1 parent 9a53137 commit ea21d12

File tree

49 files changed

+186
-268
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+186
-268
lines changed

packages/plugin-madrun/lib/add-cut-env/index.js

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

3-
const {operator} = require('putout');
43
const {
54
getExportDefault,
65
getProperty,
76
} = operator;
87

9-
module.exports.report = () => `Call 'await cutEnv(script)' instead of 'script'`;
8+
export const report = () => `Call 'await cutEnv(script)' instead of 'script'`;
109

11-
module.exports.replace = () => ({
10+
export const replace = () => ({
1211
'[__a, __b]': '[__a, cutEnv(__b)]',
1312
});
1413

15-
module.exports.match = () => ({
14+
export const match = () => ({
1615
'[__a, __b]': ({__b}, path) => {
1716
const exportDefault = getExportDefault(path);
1817

packages/plugin-madrun/lib/add-cut-env/index.spec.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 convert from './index.js';
23

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

packages/plugin-madrun/lib/add-fix-lint/index.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
'use strict';
2-
3-
const {
1+
import {
42
types,
53
operator,
64
template,
7-
} = require('putout');
5+
} from 'putout';
86

97
const {stringLiteral, objectProperty} = types;
108
const {
@@ -16,13 +14,13 @@ const fixLintScript = template.ast(`
1614
() => run('lint', '--fix')
1715
`);
1816

19-
module.exports.report = () => `fix:lint should exist`;
17+
export const report = () => `fix:lint should exist`;
2018

21-
module.exports.fix = (path) => {
19+
export const fix = (path) => {
2220
replaceWithMultiple(path, [path.node, objectProperty(stringLiteral('fix:lint'), fixLintScript)]);
2321
};
2422

25-
module.exports.traverse = ({push}) => ({
23+
export const traverse = ({push}) => ({
2624
'module.exports = __object'(path) {
2725
const rightPath = path.get('right');
2826
const lint = getProperty(rightPath, 'lint');

packages/plugin-madrun/lib/add-fix-lint/index.spec.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 addFixLint from './index.js';
23

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

packages/plugin-madrun/lib/add-function/index.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
'use strict';
2-
3-
const {types, operator} = require('putout');
1+
import {types, operator} from 'putout';
42

53
const {replaceWith, extract} = operator;
64
const {
@@ -9,13 +7,13 @@ const {
97
arrowFunctionExpression,
108
} = types;
119

12-
module.exports.report = ({name}) => `Use 'function' instead of 'string' in script: '${name}'`;
10+
export const report = ({name}) => `Use 'function' instead of 'string' in script: '${name}'`;
1311

14-
module.exports.fix = ({path}) => {
12+
export const fix = ({path}) => {
1513
replaceWith(path, arrowFunctionExpression([], path.node));
1614
};
1715

18-
module.exports.traverse = ({push}) => ({
16+
export const traverse = ({push}) => ({
1917
'export default __object'(path) {
2018
const properties = path.get('declaration.properties');
2119

packages/plugin-madrun/lib/add-function/index.spec.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 addFunction from './index.js';
23

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

packages/plugin-madrun/lib/add-missing-quotes-to-watcher/index.js

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

3-
const {types} = require('putout');
43
const {
54
isCallExpression,
65
isTemplateLiteral,
76
} = types;
87

9-
module.exports.report = () => `Add missing quotes to watcher`;
8+
export const report = () => `Add missing quotes to watcher`;
109

11-
module.exports.match = () => ({
10+
export const match = () => ({
1211
'await run("test")': (vars, {parentPath}) => {
1312
if (isTemplateLiteral(parentPath)) {
1413
const {quasis} = parentPath.node;
@@ -27,7 +26,7 @@ module.exports.match = () => ({
2726
},
2827
});
2928

30-
module.exports.replace = () => ({
29+
export const replace = () => ({
3130
'await run("test")': (vars, path) => {
3231
const {parentPath} = path;
3332

packages/plugin-madrun/lib/add-missing-quotes-to-watcher/index.spec.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 plugin from './index.js';
23

3-
const {createTest} = require('@putout/test');
4-
const plugin = require('.');
5-
6-
const test = createTest(__dirname, {
4+
const test = createTest(import.meta.url, {
75
plugins: [
86
['add-missing-quotes-to-watcher', plugin],
97
],

0 commit comments

Comments
 (0)