π 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
Bot releases are visible (Hide)
Published by coderaiser 11 months ago
Published by coderaiser 11 months ago
Published by coderaiser 11 months ago
Published by coderaiser 11 months ago
Published by coderaiser 11 months ago
Published by coderaiser 11 months ago
Published by coderaiser 11 months ago
Published by coderaiser 11 months ago
Published by coderaiser 11 months ago
Published by coderaiser 11 months ago
Published by coderaiser 11 months ago
Published by coderaiser 11 months ago
Published by coderaiser 11 months ago
Published by coderaiser 11 months ago
Published by coderaiser 11 months ago
Published by coderaiser 11 months ago
Published by coderaiser 11 months ago
Published by coderaiser 11 months ago
Published by coderaiser 12 months ago
The soul can never be cut into pieces by any weapon, nor can he be burned by fire, nor moistened by water, nor withered by the wind.
(c) Bhagavad Gita
Hi folks π!
The time is come for a new major release. It has some interesting visual features, and a couple breaking changes related to rule names.
That's right! Now you can see how much time is gone while you linting. Use:
putout . -f time
to use @putout/formatter-time
as a formatter.
With help of @putout/cli-choose-formatter
using:
putout -i
you can choose the formatter you like for you next lint:
There is a thing that was impossible to do in πPutout until today: lint filesystem.
But everything is changed now! Lint file system is as simple as running redlint:
redlint
It generates file .filesystem.json
:
{
"type": "directory",
"filename": "/home/coderaiser/putout",
"files": [{
"type": "file",
"filename": "/home/coderaiser/putout/README.md",
}, {
"type": "directory",
"filename": "/home/coderaiser/putout/lib",
"files": [{
"type": "file",
"filename": "/home/coderaiser/putout/lib/putout.js",
}]
}]
}
Let's suppose you want to rename README.md
to readme.md
.
You can traverse AST-representation of a filesystem
using findFile()
and modify it using renameFile()
.
Here is how Replacer can look like:
const FS = '__putout_processor_filesystem(__object)';
export const report = () => `Rename 'README.md' to 'readme.md'`;
export const fix = (path) => {
renameFile(path, 'readme.md');
};
export const traverse = () => ({
[FS](path) {
const [filePath] = findFiles(path, 'README.md');
push(filePath);
}
});
Here is modified AST-representation of a filesystem
:
{
"type": "directory",
"filename": "/home/coderaiser/putout",
"files": [{
"type": "file",
"filename": "/home/coderaiser/putout/readme.md"
}, {
"type": "directory",
"filename": "/home/coderaiser/putout/lib",
"files": [{
"type": "file",
"filename": "/home/coderaiser/putout/lib/putout.js"
}]
}]
}
When you run it from terminal - modifications will be applied to filesystem.
It is possible, thanks to:
@putout/plugin-filesystem
@putout/cli-filesystem
@putout/operator-filesystem
@putout/processor-filesystem
So now you have ability to create rules with atomic updates to your filesystem, just in the browser using πPutout Editor, π±Mobile Putout Editor, distribute it using npm
and test it with @putout/test
with no mocking at all π.
βοΈ Checkout out in πPutout Editor
A couple breaking changes have been made to simplify rules structure, and decrease dependencies count.
convert-esm-to-commonjs
and convert-commonjs-to-esm
merged to @putout/plugin-nodejs
CommonJS is a module system supported in Node, it provides a
require
function, which can be used to access theexports
object exposed by another file.EcmaScript module syntax is the standard way to import and export values between files in JavaScript. The
import
statement can be used to reference a value exposed by theexport
statement in another file.(c) parceljs
This rules now disabled by default. That's right, now you can make Nested Plugin rules disabled, by default with help of:
const convert = require('./convert-commonjs-to-esm');
module.exports.rules = {
'convert-commonjs-to-esm': ['off', convert];
}
{
"rules": {
+ "convert-esm-to-commonjs": "on",
+ "convert-commonjs-to-esm": "on',
- "nodejs/convert-esm-to-commonjs": "on",
- "nodejs/convert-commonjs-to-esm": "on',
}
}
convert-mock-require-to-mock-import
merged to @putout/plugin-tape
{
"rules": {
- "convert-mock-require-to-mock-import": "off",
+ "tape/mock-require-to-mock-import": "off",
}
}
nodejs/convert-exports-to-module-exports
One new rule appeared (#191).
Since exports = 5
wan't make any export, just change value of variable. Checkout in πPutout Editor.
exports.x = 5;
module.exports.x = 5;
That's all for now, have a nice day π¦!
Published by coderaiser 12 months ago