🐊 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
Published by coderaiser about 3 years ago
Published by coderaiser over 3 years ago
Published by coderaiser over 3 years ago
Published by coderaiser over 3 years ago
Published by coderaiser over 3 years ago
That's right, now Putout
has logo :).
UPDATE
env variablePublished by coderaiser over 3 years ago
Published by coderaiser over 3 years ago
Published by coderaiser over 3 years ago
Published by coderaiser over 3 years ago
Published by coderaiser over 3 years ago
Published by coderaiser over 3 years ago
Published by coderaiser over 3 years ago
Just added new action, source code spell checker typos. Expect to see less of those in future 😅 .
Published by coderaiser over 3 years ago
Processors had simple but not intuitive API
, for example process(rawSource, {fix}) -> [places, processedSource]
took two arguments: rawSource
and fix
from options
. It require implementor to take decision about handling boolean
option fix
, and added conditions in all Processors
. Now it's split into two methods:
find
- returns places that can be shown by putout
fix
- returns modified sourceAlso there is new names for preProcess
and postProcess
:
branch(source) -> list
- gets javascript
array from source
merge(source, list) -> source
- join list
into source
If you wandering:
🤷♂️ Why not split
and join
?
☝️ split is string
method and join is array
method, so using them in something other with different set of arguments and doing technically different task - makes code unclear and breaks Principle of least astonishment.
🤷♂️ Why it looks like a git
commands?
☝️ Yes it looks, and there is an idea behind it. Git
commands has same names:
branch
to list branches;merge
to merge one branch into another;So in a similar manner Processor branch
splits source
into a list of JavaScript
sources, and merge
do vice versa: join it back.
🤷♂️ How to convert processors I already written for putout < v18
to a new format?
☝️ New rule convert-process-to-find was added in @putout/[email protected]
. It will help you to migrate to new API
with less possible pain.
🤷♂️ How can I test my processors
so they was as stable and easily maintainable as putout
?
☝️ You can use @putout/test/processor for this purpose, it will help you to write simplest possible tests with help of supertape.
Here is updated working diagram:
Published by coderaiser over 3 years ago
Published by coderaiser over 3 years ago
Published by coderaiser over 3 years ago
Published by coderaiser over 3 years ago
Published by coderaiser over 3 years ago
Published by coderaiser over 3 years ago
Published by coderaiser over 3 years ago