@putout/plugin-madrun

putout plugin adds ability to find and remove process.exit

Usage no npm install needed!

<script type="module">
  import putoutPluginMadrun from 'https://cdn.skypack.dev/@putout/plugin-madrun';
</script>

README

@putout/plugin-madrun NPM version

🐊Putout plugin adds ability to fix issues with madrun config file.

Install

npm i putout @putout/plugin-madrun -D

Rules

{
    "rules": {
        "madrun/add-function": "on",
        "madrun/add-fix-lint": "on",
        "madrun/add-run": "on",
        "madrun/call-run": "on",
        "madrun/convert-run-argument": "on",
        "madrun/convert-run-to-cut-env": "on",
        "madrun/convert-cut-env-to-run": "on",
        "madrun/rename-series-to-run": "on",
        "madrun/rename-eslint-to-putout": "on",
        "madrun/set-lint-dot": "on",
        "madrun/convert-to-async": "on",
        "madrun/convert-nyc-to-c8": "on",
        "madrun/set-report-lcov": "on",
        "madrun/remove-check-duplicates-from-test": "on"
    }
}

add-function

❌ Incorrect code example

module.exports = {
    hello: 'world',
};

✅ Correct code Example

module.exports = {
    hello: () => 'world',
};

add-fix-lint

❌ Incorrect code example

const {run} = require('madrun');

module.exports = {
    lint: 'putout lib test',
};

✅ Correct code Example

const {run} = require('madrun');

module.exports = {
    'lint': 'putout lib test',
    'fix:lint': run('lint', '--fix'),
};

add-run

❌ Incorrect code example

module.exports = {
    lint: 'putout lib test',
};

✅ Correct code Example

const {run} = require('madrun');

module.exports = {
    lint: 'putout lib test',
};

convert-run-argument

❌ Incorrect code example

module.exports = {
    hello: () => run(['a']),
};

✅ Correct code Example

module.exports = {
    hello: () => run('a'),
};

convert-run-to-cut-env

❌ Incorrect code example

export default {
    'test': () => [env, 'npm test'],
    'test:only': () => 'npm test',
    'coverage': async () => [env, await run('test')],
    'coverage:only': async () => [env, await run('test:only')],
};

✅ Correct code Example

export default {
    'test': () => [env, 'npm test'],
    'test:only': () => 'npm test',
    'coverage': async () => [env, await cutEnv('test')],
    'coverage:only': async () => [env, await run('test:only')],
};

convert-cut-env-to-run

❌ Incorrect code example

export default {
    'test': () => [env, 'npm test'],
    'test:only': () => 'npm test',
    'coverage': async () => [env, await cutEnv('test')],
    'coverage:only': async () => [env, await cutEnv('test:only')],
};

✅ Correct code Example

export default {
    'test': () => [env, 'npm test'],
    'test:only': () => 'npm test',
    'coverage': async () => [env, await cutEnv('test')],
    'coverage:only': async () => [env, await run('test:only')],
};

rename-eslint-to-putout

❌ Incorrect code example

module.exports = {
    lint: 'eslint lib test --ignore test/fixture',
};

✅ Correct code Example

module.exports = {
    lint: 'putout lib test',
};

set-lint-dot

❌ Incorrect code example

module.exports = {
    lint: 'putout lib test',
};

✅ Correct code Example

module.exports = {
    lint: 'putout .',
};

convert-to-async

❌ Incorrect code example

module.exports = {
    lint: () => String(run('hello')),
};

✅ Correct code Example

module.exports = {
    lint: async () => String(await run('hello')),
};

convert-nyc-to-c8

❌ Incorrect code example

export default {
    coverage: () => 'nyc npm test',
    report: () => `nyc report --reporter=text-lcov | coveralls`,
};

✅ Correct code Example

export default {
    coverage: () => 'c8 npm test',
    report: 'c8 report --reporter=lcov',
};

set-report-lcov

❌ Incorrect code example

export default {
    'report': () => `c8 report --reporter=text-lcov | coveralls || true`,
};

✅ Correct code Example

export default {
    report: 'c8 report --reporter=lcov',
};

remove-check-duplicates-from-test

❌ Incorrect code example

export default {
    'test': () => 'tape -d *.js',
};

✅ Correct code Example

export default {
    'test': () => 'tape *.js',
};

declare

❌ Incorrect code example

export default {
    'coverage': async () => [env, `c8 ${await cutEnv('test')}`],
};

✅ Correct code Example

import {cutEnv} from 'madrun';
export default {
    'coverage': async () => [env, `c8 ${await cutEnv('test')}`],
};

License

MIT