@putout/plugin-madrun
v20.0.0
Published
๐Putout plugin adds ability to transform madrun scripts
Downloads
54,176
Maintainers
Readme
@putout/plugin-madrun 
CLI tool to run multiple npm-scripts in a madly comfortable way.
(c) Madrun
๐Putout plugin adds ability to fix issues with Madrun config file.
Install
npm i putout @putout/plugin-madrun -D
Rules
- โ add-cut-env;
- โ add-fix-lint;
- โ add-function;
- โ add-missing-quotes-to-watcher;
- โ add-run;
- โ call-run;
- โ convert-args-to-scripts;
- โ convert-cut-env-to-run;
- โ convert-lint-lib;
- โ convert-nyc-to-c8
- โ convert-run-argument;
- โ convert-run-to-cut-env;
- โ convert-to-async;
- โ declare;
- โ remove-check-duplicates-from-test;
- โ remove-putout;
- โ remove-useless-array-in-run;
- โ remove-useless-string-conversion;
- โ rename-eslint-to-putout;
- โ rename-series-to-run;
- โ set-lint-dot;
- โ set-report-lcov;
Config
{
"rules": {
"madrun/add-function": "on",
"madrun/add-fix-lint": "on",
"madrun/add-run": "on",
"madrun/add-missing-quotes-to-watcher": "on",
"madrun/add-cut-env": "on",
"madrun/call-run": "on",
"madrun/convert-run-argument": "on",
"madrun/convert-args-to-scripts": "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",
"madrun/remove-useless-array-in-run": "on",
"madrun/remove-useless-string-conversion": "on"
}
}
add-function
โ Example of incorrect code
module.exports = {
hello: 'world',
};
โ Example of correct code
module.exports = {
hello: () => 'world',
};
add-fix-lint
โ Example of incorrect code
const {run} = require('madrun');
module.exports = {
lint: 'putout lib test',
};
โ Example of correct code
const {run} = require('madrun');
module.exports = {
'lint': 'putout lib test',
'fix:lint': run('lint', '--fix'),
};
add-missing-quotes-to-watcher
Checkout in ๐Putout Editor.
โ Example of incorrect code
export default {
'watch:test': async () => await run('watcher', await run('test')),
};
โ Example of correct code
export default {
'watch:test': async () => await run('watcher', `"${await run('test')}"`),
};
add-run
โ Example of incorrect code
module.exports = {
lint: 'putout lib test',
};
โ Example of correct code
const {run} = require('madrun');
module.exports = {
lint: 'putout lib test',
};
add-cut-env
โ Example of incorrect code
export default {
'test': () => [env, 'test:only'],
'test:only': () => [env, 'npm test'],
};
โ Example of correct code
import {cutEnv} from 'madrun';
export default {
'test': async () => [testEnv, await cutEnv('test:only')],
'test:only': () => [env, 'npm test'],
};
convert-run-argument
โ Example of incorrect code
module.exports = {
hello: () => run(['a']),
};
โ Example of correct code
module.exports = {
hello: () => run('a'),
};
convert-args-to-scripts
Check out in ๐Putout Editor.
โ Example of incorrect code
export default {
build: () => 'tsup',
wisdom: () => run('build', 'test', 'test:dts'),
};
โ Example of correct code
export default {
build: () => 'tsup',
wisdom: () => run(['build', 'test', 'test:dts']),
};
convert-run-to-cut-env
โ Example of incorrect code
export default {
'test': () => [env, 'npm test'],
'test:only': () => 'npm test',
'coverage': async () => [env, await run('test')],
'coverage:only': async () => [env, await run('test:only')],
};
โ Example of correct code
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
โ Example of incorrect code
export default {
'test': () => [env, 'npm test'],
'test:only': () => 'npm test',
'coverage': async () => [env, await cutEnv('test')],
'coverage:only': async () => [env, await cutEnv('test:only')],
};
โ Example of correct code
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
โ Example of incorrect code
module.exports = {
lint: 'eslint lib test --ignore test/fixture',
};
โ Example of correct code
module.exports = {
lint: 'putout lib test',
};
set-lint-dot
โ Example of incorrect code
module.exports = {
lint: 'putout lib test',
};
โ Example of correct code
module.exports = {
lint: 'putout .',
};
convert-to-async
โ Example of incorrect code
module.exports = {
lint: () => String(run('hello')),
};
โ Example of correct code
module.exports = {
lint: async () => String(await run('hello')),
};
convert-nyc-to-c8
โ Example of incorrect code
export default {
coverage: () => 'nyc npm test',
report: () => `nyc report --reporter=text-lcov | coveralls`,
};
โ Example of correct code
export default {
coverage: () => 'c8 npm test',
report: 'c8 report --reporter=lcov',
};
set-report-lcov
โ Example of incorrect code
export default {
report: () => `c8 report --reporter=text-lcov | coveralls || true`,
};
โ Example of correct code
export default {
report: 'c8 report --reporter=lcov',
};
remove-check-duplicates-from-test
โ Example of incorrect code
export default {
test: () => 'tape -d *.js',
};
โ Example of correct code
export default {
test: () => 'tape *.js',
};
remove-useless-array-in-run
Checkout in ๐Putout Editor.
โ Example of incorrect code
export default {
time: async () => await run(['lint:fresh', '-f time']),
};
โ Example of correct code
export default {
time: async () => await run('lint:fresh', '-f time'),
};
remove-useless-string-conversion
Checkout in ๐Putout Editor.
โ Example of incorrect code
export default {
time: async () => [testEnv, String(await cutEnv('test:raw'))],
};
โ Example of correct code
export default {
time: async () => [testEnv, await cutEnv('test:raw')],
};
declare
โ Example of incorrect code
export default {
coverage: async () => [env, `c8 ${await cutEnv('test')}`],
};
โ Example of correct code
import {cutEnv} from 'madrun';
export default {
coverage: async () => [env, `c8 ${await cutEnv('test')}`],
};
License
MIT