π 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 10 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
The moment you know your real being, you are afraid of nothing. Death gives freedom and power. To be free in the world, you must die to the world. Then the universe is your own, it becomes your body, an expression and a tool. The happiness of being absolutely free is beyond description.
Sri Nisargadatta Maharaj
Hi folks! The time is come for the next big πPutout release π! Next version has a couple breaking changes, to the point!
The time is come to drop support of deprecated versions of Node, that is not supported, so no new features and security fixes.
From now if you want to use πPutout as loader run:
node --import putout/register hello.js
@putout/plugin-strict-mode
with @putout/plugin-nodejs
Strict Mode makes several changes to normal JavaScript semantics:
- Eliminates some JavaScript silent errors by changing them to throw errors.
- Fixes mistakes that make it difficult for JavaScript engines to perform optimizations: strict mode code can sometimes be made to run faster than identical code that's not strict mode.
- Prohibits some syntax likely to be defined in future versions of ECMAScript.
(c) MDN
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.(c) parceljs
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
Strict Mode is useful for CommonJS which is default Module System of node.js. It is supported by Deno and Bun only for compatibility reason, since EcmaScript Modules uses Strict Mode by default. So one dependency less π.
v16
Stylelint deprecated all rules related to formatting, and now Prettier used for this purpose, also it dropped support of node < 18.
There is a new plugin type Scanner. When you want create a new file hello.txt
:
[
"/",
["/hello.txt", "hello world"]
]
Here is how it looks like:
module.exports.report = () => 'Create file hello.txt';
module.exports.fix = (rootPath) => {
createFile(rootPath, 'hello.txt', 'hello world');
};
module.exports.scan = (rootPath) => {
const [filePath] = findFile(rootPath, 'hello.txt');
if (filePath)
return null;
return rootPath;
};
Now you can use simplified format of Filesystem:
__putout_processor_filesystem([
'/',
'/hello.txt',
[
'/world.txt',
'hello world',
],
'/abc/',
]);
Which is the same as:
__putout_processor_filesystem({
type: 'directory',
filename: '/',
files: [{
type: 'file',
filename: '/hello.txt',
}, {
type: 'file',
filename: '/world.txt',
content: 'hello world',
}, {
type: 'directory',
filename: '/abc',
files: [],
}],
});
With help of two new rules:
filesystem/convert-simple-filesystem-to-filesystem
;filesystem/convert-filesystem-to-simple-filesystem
;@putout/operator-filesystem
became more mature π!
There is a couple new rules in @putout/plugin-nodejs
, that is disabled by default, but they will work when you run:
npx redlint && putout .filesystem.json
It will generate .filesystem.json
and applies next rules.
nodejs/rename-file-cjs-to-js
Rename *.cjs
files when module !== "module":
/
|-- package.json
`-- lib/
- `-- hello.cjs
+ `-- hello.js
Check out in πPutout Editor.
nodejs/rename-file-mjs-to-js
Rename *.mjs
files when module === "module"
:
/
|-- package.json
`-- lib/
- `-- hello.mjs
+ `-- hello.js
You can even create css bundle
π!
That's all for now folks, have a nice day π!
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