Skip to content

Commit 47435b4

Browse files
committed
feature: @putout/plugin-apply-shorthand-properties: ESM -> CommonJS
1 parent 475a6b5 commit 47435b4

File tree

5 files changed

+18
-13
lines changed

5 files changed

+18
-13
lines changed

docs/the-book-of-ast.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ friend.
144144
```js
145145
if (fruit === '🍎')
146146
// 🌳(🍎)
147-
eat('🍎');// 🦏 ❤️ 🍎
147+
eat('🍎'); // 🦏 ❤️ 🍎
148148
```
149149

150150
"An apple can grow on a branch, but branch cannot grow on apple, the same goes to **Expressions** and **Statements**", continued 🐊**Putout**.

packages/plugin-apply-shorthand-properties/.madrun.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import {run} from 'madrun';
1+
'use strict';
22

3-
export default {
3+
const {run} = require('madrun');
4+
5+
module.exports = {
46
'publishOnly': () => run('lint'),
57
'test': () => `tape 'test/*.js'`,
68
'watch:test': async () => `nodemon -w lib -w test -x ${await run('test')}`,

packages/plugin-apply-shorthand-properties/lib/apply-shorthand-properties.js

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

3+
const {operator} = require('putout');
34
const {findBinding, rename} = operator;
45

5-
export const report = () => `Use shorthand properties`;
6+
module.exports.report = () => `Use shorthand properties`;
67

7-
export const fix = ({path, from, to, toRename}) => {
8+
module.exports.fix = ({path, from, to, toRename}) => {
89
if (toRename)
910
rename(path, from, to);
1011

1112
path.node.shorthand = true;
1213
};
1314

14-
export const traverse = ({push, options}) => ({
15+
module.exports.traverse = ({push, options}) => ({
1516
'__object'(path) {
1617
for (const propPath of path.get('properties')) {
1718
const {shorthand} = propPath.node;

packages/plugin-apply-shorthand-properties/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@putout/plugin-apply-shorthand-properties",
33
"version": "6.0.0",
4-
"type": "module",
4+
"type": "commonjs",
55
"author": "coderaiser <[email protected]> (https://github.com/coderaiser)",
66
"description": "🐊Putout plugin adds ability to apply shorthand properties",
77
"homepage": "https://github.com/coderaiser/putout/tree/master/packages/plugin-apply-shorthand-properties#readme",

packages/plugin-apply-shorthand-properties/test/apply-shorthand-properties.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
import {createTest} from '@putout/test';
2-
import * as removeUnusedVariables from '@putout/plugin-remove-unused-variables';
3-
import * as applyShorthandProperties from '../lib/apply-shorthand-properties.js';
1+
'use strict';
42

5-
const test = createTest(import.meta.url, {
3+
const applyShorthandProperties = require('../lib/apply-shorthand-properties.js');
4+
const removeUnusedVariables = require('@putout/plugin-remove-unused-variables');
5+
const {createTest} = require('@putout/test');
6+
7+
const test = createTest(__dirname, {
68
printer: 'putout',
79
plugins: [
810
['apply-shorthand-properties', applyShorthandProperties],
911
],
1012
});
1113

12-
const testWithRemove = createTest(import.meta.url, {
14+
const testWithRemove = createTest(__dirname, {
1315
printer: 'putout',
1416
plugins: [
1517
['apply-shorthand-properties', applyShorthandProperties],

0 commit comments

Comments
 (0)