Skip to content

Releases: coderaiser/putout

putout v42.0.3

16 Feb 22:39

Choose a tag to compare

🔥 feature

  • ca69675 putout: @putout/operator-sort-ignore v2.0.0
  • 404278c @putout/operator-sort-ignore: add support of globs at the begining
  • 5c76aed @putout/operator-sort-ignore: drop support of 🐊 < 42

putout v42.0.2

16 Feb 22:14

Choose a tag to compare

🔥 feature

  • 0bfbbbb putout: @putout/plugin-spread v3.0.0
  • 2017f40 @putout/plugin-spread: drop support of 🐊 < 42
  • a6d9d2a @putout/plugin-typescript: drop support of 🐊 < 42
  • a5abe1d root: redlint v6.0.0
  • f1d47cf root: madrun v13.0.0

putout v42.0.1

16 Feb 20:06

Choose a tag to compare

🔥 feature

  • f91fbe9 putout: @putout/plugin-esm v10.0.0
  • 382bb70 @putout/plugin-esm: drop support of 🐊 < 42
  • e00508d @putout/plugin-esm: resolve-imported-file: no extension

Putout v42

16 Feb 19:37

Choose a tag to compare

image

नित्य आत्माव्यय: शुद्ध: सर्वग: सर्ववित्पर: ।
धत्तेऽसावात्मनो लिङ्गं मायया विसृजन्गुणान् ॥ २२ ॥

nitya ātmāvyayaḥ śuddhaḥ
sarvagaḥ sarva-vit paraḥ
dhatte ’sāv ātmano liṅgaṁ
māyayā visṛjan guṇān

The spirit soul, the living entity, has no death, for he is eternal and inexhaustible. Being free from material contamination, he can go anywhere in the material or spiritual worlds. He is fully aware and completely different from the material body, but because of being misled by misuse of his slight independence, he is obliged to accept subtle and gross bodies created by the material energy and thus be subjected to so-called material happiness and distress. Therefore, no one should lament for the passing of the spirit soul from the body.

(c) Śrīmad-Bhāgavatam 7.2.22

Hi folks 🎈!
The time is come for a new major release of 🐊Putout. This release has a couple breaking changes and some new features, so get a cup with hot tea ☕️, enjoy reading!

📛 @putout/filesystem a bit simplified

@putout/filesystem a bit simplified:

{
    "rules": {
-       "filesystem/remove-travis-yml-file": "off",
-       "filesystem/remove-vim-swap-file": "off",
-       "filesystem/remove-nyc-output-file": "off",
-       "filesystem/remove-ds-store-file": "off",
-       "filesystem/remove-empty-directory": "off",
+       "filesystem/remove-files": "off",
  }
}

It is handled by @putout/plugin-putout-config 😏.

📛 Dropped support of ESLint < v10

eslint-plugin-putout requires ESLint >= v10
it is just released, so is better to upgrade.
Babel also already supports it.

@putout/operator-remove-files

Welcome new operator in a hood!

When you need to create a new plugin for RedLint that removes some kind of files just use:

import {operator} from 'putout';

const {removeFiles} = operator;

export const {
    report,
    fix,
    scan,
} = removeFiles(['.DS_Store']);

@putout/operator-sort-ignore

When you need to sort things up

ignore

from:

node_modules
*.swp
yarn-error.log
yarn.lock
.idea
.DS_Store
deno.lock

coverage
.filesystem.json

to:

.idea
.filesystem.json
.DS_Store

*.swp

yarn-error.log
yarn.lock
deno.lock

node_modules
coverage

use:

import {operator} from 'putout';

const {sortIgnore} = operator;

export const {
    report,
    fix,
    traverse,
} = sortIgnore({
    name: '.gitignore',
});

json

And to sort up JSON:

{
    "ignore": [
        "**/package-lock.json",
        "**/*.lock",
        "**/.git",
        "**/*.log",
        "**/node_modules"
    ]
}

to

{
    "ignore": [
        "**/*.lock",
        "**/*.log",
        "**/.git",
        "**/package-lock.json",
        "**/node_modules"
    ],
}

Use:

import {operator} from 'putout';

const {sortIgnore, __json} = operator;

export const {
    report,
    fix,
    traverse,
} = sortIgnore({
    name: '.gitignore',
    type: __json,
    property: 'ignore',
});

Totally ESM

🐊Putout now 100% ESM, since it is:

Linter that do not afraid to act like codemod

With help of:

You can migrate any kind of JavaScript codebase from CommonJS to ESM.

Here is the algorithm:

  1. Change type of your package.json from commonjs to module;
  2. Run putout --fix ., it will fix any code that uses require and module.exports to import and export;
  3. Run redlint fix, it will resolve import names and change import {readFile} from './reader' to import {readFile} from './reader.js`;

That's it!

If you avoid any kinds of hacks, like:

using mock-require:

❌ Example of incorrect code

// mock modules worked in CommonJS, but not in ESM
mockRequire('fs', {
    readFile,
});

run(code);

✅ Example of correct code

// use dependency injection instead
run(code, {
    readFile
});

using same names for exported and internal functions:

❌ Example of incorrect code

// 'run' already declared so we cannot just use 'const run = () => {run();}'
module.exports.run = () => {
    return run();
};

function run() {
}

✅ Example of correct code

// easy to migrate to `export const run = () => {return runAll();}`, since no overlap with names
module.exports.run = () => {
    return runAll();
};

function runAll() {
}

and reserved words

❌ Example of incorrect code

// 'delete is reserved word, you cannot use it to name variable `export const delete = () => {}`
module.exports.delete = () => {};

✅ Example of correct code

// it would be 'export const remove = () => {}`, so no problem at all
module.exports.remove = () => {}

If you check your code before migration, or a bit fix after migration to avoid such patterns, it will be much easier!
Any ways 🐊Putout always here to help you with any kind of your migrations 😏.

That's all for today, have a nice evening 🐈!

🔥 feature

  • 6e5593b root: eslint-plugin-putout v31.0.0
  • 2b07e47 putout: @putout/engine-runner v28.0.0
  • befa4fe @putout/engine-runner: @putout/plugin-filesystem v13.0.0
  • 489ba89 eslint-plugin-putout: @putout/eslint-config v14.0.0
  • b9c7dff eslint-plugin-putout: drop support of 🐊 < 42
  • c645ea2 putout: @putout/plugin-putout v29.0.0
  • 04562f1 @putout/plugin-putout: drop support of 🐊 < 42
  • 4404672 putout: @putout/plugin-putout-config v12.0.0
  • fe7d380 putout: @putout/plugin-filesystem v13.0.0
  • c65d949 @putout/eslint-config: drop support of eslint < 10
  • cc19c8d @putout/eslint-config: no-dupe-keys -> remove-duplicate-keys
  • 0a3ddfe @putout/plugin-filesystem: drop support of 🐊 < 42
  • fac5e2e @putout/plugin-putout-config: drop support of 🐊 < 42
  • b0add92 @putout/plugin-apply-filesystem: add
  • 874547f putout: config: ignore: coverage -> coverage/*
  • 427d4be @putout/plugin-filesystem: remove-files: merge
  • 0a8182a @putout/operator-remove-files: add dismiss
  • 2b92e54 @putout/operator-filesystem: findFile: array -> avoid duplications
  • 56caf89 @putout/operator-remove-files: add
  • 5cfbfaf eslint-plugin-putout: rm eslint-v10/babel

putout v41.25.1

15 Feb 20:12

Choose a tag to compare

🐞 fix

🔥 feature

  • 086aa95 putout: ignore: apply mask
  • 1807425 @putout/plugin-putout-config: sort-ignore: add
  • 0821779 @putout/operator-sort-ignore: report when property passed
  • dbf82a2 @putout/operator-sort-ignore: __json: no property

putout v41.25.0

15 Feb 12:15

Choose a tag to compare

🐞 fix

  • 0309987 @putout/plugin-converage: names

🔥 feature

  • 73b58c9 putout: simplify ignore
  • b324c69 eslint-plugin-putout: private imports
  • 1fa23da @putout/plugin-coverage: sort

putout v41.24.0

14 Feb 22:23

Choose a tag to compare

🐞 fix

  • e11e3a3 @putout/operator-ignore: rm useless return
  • b2eb662 @putout/operator-ignore: description

🔥 feature

  • 641e945 @putout/operator-sort-ignore: add
  • ea8c144 @putout/plugin-putout: declare: sortIgnore
  • c3c22c8 @putout/plugin-putout: apply-traverser-to-ignore
  • bff521c @putout/plugin-remove-useless-map: eslint-plugin-putout v30.0.3
  • 78569cb @putout/operator-ignore: Replacer -> Traverser: improve reporting

putout v41.23.0

13 Feb 17:51

Choose a tag to compare

🐞 fix

  • b9e45ab @putout/plugin-remove-useless-map: rm unused dependencies

🔥 feature

  • 6a606a6 @putout/plugin-sort-ignore: add
  • 852676f @putout/operator-ignore: match globs
  • 254f8da @putout/operator-ignore: report

putout v41.22.0

13 Feb 15:34

Choose a tag to compare

🔥 feature

  • 01f953a putout: @putout/plugin-gitignore v7.0.0
  • e52061c @putout/plugin-gitignore: drop support of 🐊 < 41
  • 138113a putout: @putout/plugin-npmignore v7.0.0
  • da43ad1 putout: @putout/plugin-coverage v2.0.0
  • 0225122 putout: @putout/operator-ignore v6.0.0
  • edd6530 @putout/plugin-converage: drop support of 🐊 < 41
  • 156c2ed @putout/operator-ignore: type
  • e6b311e @putout/plugin-simplify-ternary: isFn

putout v41.21.2

13 Feb 12:23

Choose a tag to compare

🔥 feature

  • a34269c putout: @putout/operator-keyword v5.0.0
  • 886192a @putout/operator-keyword: assert: isKeyword -> isLegacyKeyword
  • cedb0aa @putout/plugin-socket-io: add