putout

🐊 Pluggable and configurable JavaScript Linter, code transformer and formatter with built-in ESLint and Babel support for js, jsx typescript, flow, markdown, yaml and json. Write declarative codemods in a simplest possible way 😏

MIT License

Downloads
3.6M
Stars
646
Committers
23

Bot releases are hidden (Show)

putout - putout v30.4.1

Published by coderaiser over 1 year ago

πŸ”₯ feature

  • 5f1993c4f package: @putout/plugin-github v6.0.0
  • e083d0791 @putout/plugin-github: createUsesFixer -> setVersion
  • d3c2517b9 @putout/plugin-github: drop support of 🐊 < 30
  • 6bfe1c4ce @putout/plugin-github: add-continue-on-error: coveralls, add-and-commit
  • b3e64ff7e eslint-plugin-putout: single-property-destructuring: exclude computed
putout - putout v30.4.0

Published by coderaiser over 1 year ago

πŸ”₯ feature

  • d3579eedf package: @putout/plugin-remove-useless-array-constructor v2.0.0
  • ecfe465a6 @putout/plugin-remove-useless-array-constructor: drop support of 🐊 < 30
  • 98170e84f @putout/plugin-remove-useless-array-constructor: report
  • 701e0aabf package: @putout/plugin-remove-duplicate-case v3.0.0
  • e792f8309 @putout/plugin-remove-duplicate-case: drop support of 🐊 < 30
  • f14120595 @putout/plugin-remove-duplicate-case: report
  • 168d5308c package: @putout/plugin-typescript v4.0.0
  • 3f0a3e034 @putout/plugin-typescript: drop support of 🐊 < 30
  • c9772e64a @putout/plugin-typescript: remove-duplicate-interface-keys: report
  • 8d341536d package: @putout/plugin-types v2.0.0
  • 9758ef3fe @putout/plugin-types: drop support of 🐊 < 30
  • 0027cacd5 @putout/plugin-types: remove-useless-typeof: report
  • 983ed74fe package: unist-util-visit v5.0.0
putout - putout v30.3.1

Published by coderaiser over 1 year ago

πŸ”₯ feature

  • 2b2674bdd package: @putout/engine-processor v8.0.0
  • ba1061c7e package: @putout/engine-loader v10.0.0
  • 10f632bd4 package: nodemon v3.0.1
putout - putout v30.3.0

Published by coderaiser over 1 year ago

πŸ”₯ feature

putout - putout v30.2.3

Published by coderaiser over 1 year ago

πŸ”₯ feature

  • 830e1b0d4 package: @putout/plugin-remove-unreferenced-variables v3.0.0
  • 699b8f2c7 package: @putout/plugin-for-of v2.0.0
  • 3fc4a114c @putout/plugin-for-of: drop support of 🐊 < 30
  • 58b201cd1 @putout/plugin-for-of: improve support of @putout/plugin-remove-unreferenced-variables
  • b1e7d140c @putout/plugin-remove-unreferenced-variables: drop support of 🐊 < 30
  • 54bbefbf3 @putout/plugin-remove-unreferenced-variables: improve support of @putout/plugin-for-of
  • fb9b9df38 @putout/plugin-promises: add-missing-await: react: exclude useEffect
  • 80bf66dc5 @putout/plugin-promises: convert-new-promise-to-async: exclude names other then resolve, reject
putout - putout v30.2.2

Published by coderaiser over 1 year ago

🐞 fix

  • b12de56b3 putout: --soft: has no sense, since after fix places.length always none
putout - putout v30.2.1

Published by coderaiser over 1 year ago

πŸ”₯ feature

  • e5edb5389 package: @putout/plugin-remove-useless-functions v3.0.0
  • f1c7edb07 @putout/plugin-remove-useless-functions: report
  • 9f4667994 @putout/plugin-promises: convert-new-promise-to-async: different scopes
  • a1ea8101b package: estree-to-babel v6.0.0
  • 6f1f0a97a @putout/operator-add-args: improve support of more then two params
putout - putout v30.2.0

Published by coderaiser over 1 year ago

πŸ”₯ feature

  • 2989df2d6 package: @putout/plugin-strict-mode v7.0.0
  • 1fa43e078 package: @putout/plugin-putout v13.0.0
  • ca3aac450 package: @putout/plugin-remove-unused-expressions v7.0.0
  • f5fbabe8c @putout/plugin-remove-unused-expressions: drop support of 🐊 < 30
  • d28a985ce @putout/engine-parser: use directives for @putout/printer
  • 3e98931c4 @putout/plugin-putout: drop support of 🐊 < 30
  • 3b6348134 @putout/plugin-strict-mode: drop support of 🐊 < 30
  • 6ae6ec300 @putout/plugin-strict-mode: add support of directives
putout - putout v30.1.1

Published by coderaiser over 1 year ago

🐞 fix

  • a85468f84 putout: --no-force -> --soft
  • 349b3f37d @putout/test: UPDATE

πŸ”₯ feature

  • d2a54529b @putout/test: drop formatSave, formatManySave
putout - putout v30.1.0

Published by coderaiser over 1 year ago

πŸ”₯ feature

  • 91a14b37d putout: --no-force: add
  • d2ac969c3 @putout/plugin-promise: convert-new-promise-to-async: arrow function without body
  • 7c281c4f6 package: stylelint-config-standard v34.0.0
putout - putout v30.0.3

Published by coderaiser over 1 year ago

πŸ”₯ feature

  • f0e9054b0 package: @putout/engine-loader v10.0.0
  • daf5b7fd9 package: @putout/engine-parser v7.1.0
  • 1fc9ff504 @putout/engine-parser: add support of Explicit Resource Management (https://github.com/tc39/proposal-explicit-resource-management)
  • 42b95219c package: eslint-plugin-putout v18.0.0
  • 6ba4a3b38 eslint-plugin-putout: drop support of 🐊 < 30
putout - putout v30.0.2

Published by coderaiser over 1 year ago

πŸ”₯ feature

  • df1157183 package: @putout/traverse v7.0.0
  • a2c5dd3b4 package: @putout/operator-declare v6.0.1
  • 216ac14b1 package: @putout/operator-declare v6.0.1
  • b00932964 @putout/operator-declare: drop support of 🐊 < 30
  • dca08be14 package: @putout/engine-parser v7.0.0
  • 92f16e9d5 package: @putout/operator-add-args v5.0.0
  • bc413cbab package: @putout/engine-parser v7.0.0
  • d041537e1 @putout/operator-add-args: drop support of 🐊 < 30
  • dc709ddc9 package: @putout/engine-runner v17.0.0
  • 0b9150e9b package: @putout/compare v11.0.0
  • 932bdd0f5 package: @putout/compare v11.0.0
  • eac3c05e3 package: @putout/compare v11.0.0
  • 4ea8a0616 package: @putout/compare v11.0.0
  • 1506b30d6 package: @putout/compare v11.0.0
  • d854492cc package: @putout/engine-parser v7.0.0
  • b36c50245 package: @putout/engine-parser v7.0.0
  • f7111df33 package: @putout/engine-parser v7.0.0
  • 059bc4f7c package: @putout/engine-parser v7.0.0
  • 642d38cb5 package: @putout/engine-parser v7.0.0
  • 5f5056621 package: hermes-parser v0.14.0
  • 3f47af6fa @putout/engine-parser: use @putout/printer by default
putout - putout v30.0.1

Published by coderaiser over 1 year ago

πŸ”₯ feature

  • 193b30bd3 package: @putout/plugin-promises v11.0.0
  • c77ac8e69 @putout/plugin-promises: drop support of 🐊 < 30
putout - 🐊 Putout v30

Published by coderaiser over 1 year ago

image

”Who am I? Not the body, because it is decaying; not the mind, because the brain will decay with the body; not the personality, nor the emotions, for these also will vanish with death.”

(c) Ramana Maharshi

Hi folks 🎈!

The time is come for a new big release! It has much less breaking changes then previous one.

Anyways some significant things been changes...

Alternative to recast: @putout/printer

This spring I understand that I’m tired of poor maintenance of recast. Just like JSCodeshift it doesn’t evolve by time: if you want use it - fix bugs by yourself, add feature by yourself and maybe couple months or years after you PR will be merged.

I got AST enlightenment πŸ§˜πŸ½β€β™‚οΈ and understand that I have all the knowledges to write my own printer, which I’ll support with a pleasure:

  • βœ… It is based on Babel receives AST and returns string with well-formatted JavaScript code.
  • βœ… It is highly opinionated but has two kind of options to have control over formatting.
  • βœ… The options called format used to override output characters.
  • βœ… The options called semantic used to override logic of formatting.
  • βœ… This is something on the middle of ESLint and Recast but: faster and more low level - the best of two worlds.
  • βœ… Easily expandable with two kinds of plugins support to extend formatting to any syntax you like.
  • βœ… Has 🐊Putout plugin @putout/plugin-printer to simplify development.

@putout/printer is built-in to 🐊Putout, so you have ability to gain full control of your source code with no additional linters and formatters needed.

☒️ BREAKING CHANGE

Printer

recast no longer used as default printer, so if you want it for some reason update .putout.json with:

{
    "printer": "recast"
}

remove-useless-variables/await moved to promises/remove-useless-variables

If you disabled this rule, change your .putout.json with:

{
    "rules": {
-       "remove-useless-variables/await": "off",
+       "promises/remove-useless-variables": "off"
    }
}

❌ Example of incorrect code

async () => {
    const result = transformer.transform(realTransformer, transformCode, code, parser);
    const result2 = await Promise.resolve(result);
    
    return result2;
};

βœ… Example of correct code

async () => {
    const result = transformer.transform(realTransformer, transformCode, code, parser);    
    return result;
};

@putout/minify

Actually formatting code is not the only feature of @putout/printer, it is also used for minification with @putout/plugin-minify, a plugin that contains a lot of rules to make code as small as possible.

git status --porcelain

Just got rid of isomorphic-git, and switched to a library I worked year ago: @putout/git-status-porcelain to implement --staged flag which works on a similar to lint-staged way: lint only changed files.

git-status-porcelain get names of files that was:

  • βœ… modified;
  • βœ… added;
  • βœ… renamed;

in your git repository. Also after changing some of these files it helps us to add them back to staged state so they was ready to be committed easily with:

git commit -m 'πŸ”₯🐊'

So now putout --staged --fix works about 10 times faster since everything is made by git it has very interesting text format that is easy to parse. It contains a 3-characters length string that consists of a couple big characters and space, like:

  • M - modified;
  • MM - modified, staged and then changed;
  • R - renamed;

With this information you can get the most important information without any parsing of binary files and filtering all the results using JavaScript. This is a slow process, and latest release of isomorphic-git just made --staged speed about 100 times slower. Now it works about 10 times faster 😏.

simplify-boolean-return

A couple linters started to suggest me to modify my code this way:

-if (a)
-    return true;
-
-return false;
+return a;

I’m not sure how much this code becames more readable but cognitive load becomes less on one IfStatement, and there is less to run and less to read, so for you to decide🀷 (but you should know that I just updated my codebases with this rule 😏) if you don’t need it update your .putout.json with:

{
    "rules": {
        "simplify-boolean-return": "off"
    }
}

That's all for today 🦏!

πŸ”₯ feature

  • 57c5aef40 @putout/test: processor: add ability to pass printer
  • 40fa46cc0 @putout/plugin-promises: enable convert-new-promise-to-async
  • 7875b0233 putout: use @putout/printer by default
  • 8fc9dd688 package: cosmiconfig v8.2.0
  • 9f1749ad3 package: hermes-parser v0.12.1
  • 0ff502529 package: c8 v8.0.0
  • 44f032f72 package: find-cache-dir v4.0.0
  • 9038588c6 @putout/plugin-declare-before-reference: use @putout/printer
  • 6d3f961dd @putout/plugin-npmignore: use @putout/printer
  • 74726fa72 @putout/plugin-declare: use @putout/printer
  • 652ffb21c @putout/test: noTransformWithOptions: UPDATE
  • 23858f1b7 @putout/plugin-minify: convert-array-from-to-spread: add (coderaiser/minify#107)
  • d576f572a @putout/plugin-minify: convert-if-to-logical: improve support of generators (coderaiser/minify#108)
  • a21a45e2a scripts: printer: remove drop
  • bbae438d0 @putout/plugin-remove-empty: pattern: FunctionExpression: async: add
  • e84a46600 @putout/cli-staged: add support of renamed files
  • 7b5a075d7 @putout/plugin-promises: remove-unused-variables: add from @putout/plugin-remove-unused-variables
putout - putout v29.15.0

Published by coderaiser over 1 year ago

πŸ”₯ feature

  • 69bee138c @putout/cli-staged: move out from putout
putout - putout v29.14.0

Published by coderaiser over 1 year ago

πŸ”₯ feature

putout - putout v29.13.5

Published by coderaiser over 1 year ago

πŸ”₯ feature

  • b40f60d93 package: @putout/plugin-convert-commonjs-to-esm v10.0.0
  • d7fec8229 @putout/plugin-convert-commonjs-to-esm: drop support of 🐊
  • c6b1ed02b @putout/plugin-convert-commonjs-to-esm
  • 76dd62b5c @putout/plugin-nodejs: declare-after-require: get back comments support when recast used
putout - putout v29.13.4

Published by coderaiser over 1 year ago

πŸ”₯ feature

  • cf40b4a52 package: @putout/plugin-remove-useless-spread v7.0.0
  • 116f948ef @putout/plugin-remove-useless-spread: drop support of 🐊 < 29
  • a64051bb7 @putout/plugin-remove-useless-spread: use @putout/printer
putout - putout v29.13.3

Published by coderaiser over 1 year ago

πŸ”₯ feature

  • c004b1746 package: @putout/plugin-remove-useless-template-expressions v2.0.0
  • 9aa82b10f @putout/plugin-remove-useless-template-expressions: drop support of 🐊 < 29
  • bbd78527e @putout/plugin-remove-useless-template-expressions: comments support using @putout/printer
  • 8f73dcaca @putout/plugin-types: remove-double-negations: add support of startsWith
  • 7d333d735 @putout/plugin-simplify-boolean-return: add support of UnaryExpression: !
putout - putout v29.13.2

Published by coderaiser over 1 year ago

πŸ”₯ feature

  • d1d31b4cb package: @putout/plugin-reuse-duplicate-init v5.0.0
  • 711024a22 @putout/plugin-reuse-duplicate-init: drop support of 🐊 < 29
Package Rankings
Top 1.65% on Npmjs.org
Badges
Extracted from project README
NPM version Build Status Coverage Status DeepScan putout npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm