@putout/plugin-printer

3.1.0 • Public • Published

@putout/plugin-printer NPM version

🐊Putout adds support of transformations for @putout/printer.

Install

npm i @putout/plugin-printer -D

Rules

{
    "rules": {
        "printer/add-args": "on",
        "printer/apply-breakline": "on",
        "printer/apply-linebreak": "on",
        "printer/apply-computed-print": "on",
        "printer/remove-args": "on"
    }
}

apply-breakline

-print.newline();
-indent();
print.breakline();

apply-linebreak;

-indent();
-print.newline();
print.linebreak();

add-args

❌ Example of incorrect code

module.exports = {
    TSPropertySignature(path) {
        const {optional} = path.node;
        print('__key');
        maybe.print(optional, '?');
    },
};

✅ Example of correct code

module.exports = {
    TSPropertySignature(path, {print, maybe}) {
        const {optional} = path.node;
        print('__key');
        maybe.print(optional, '?');
    },
};

apply-computed-print

❌ Example of incorrect code

print(path.get('block'));

✅ Example of correct code

print('__block');

remove-args

❌ Example of incorrect code

print.indent(is);

✅ Example of correct code

print.indent();

License

MIT

Package Sidebar

Install

npm i @putout/plugin-printer

Weekly Downloads

51

Version

3.1.0

License

MIT

Unpacked Size

7.96 kB

Total Files

8

Last publish

Collaborators

  • coderaiser