@putout/cli-ruler
v3.1.0
Published
toggle rules in .putout.json
Downloads
29,852
Readme
@putout/cli-ruler
Ruler toggler for .putout.json
.
Install
npm i @putout/cli-ruler
API
To create new file .putout.json
and disable all rules defined by places
use:
disableAll
import {rule} from '@putout/cli-ruler';
import {
readFile,
writeFile,
} from 'node:fs/promises';
const places = [{
rule: 'remove-unused-variables',
message: '"a" is defined but never used',
position: {
line: 3,
column: 6,
},
}];
const options = {
disableAll: true,
readFile,
writeFile,
};
await ruler(places, options);
It will produce .putout.json
:
{
"rules": {
"remove-unused-variables": "off"
}
}
Same with enableAll
enable
To enable one rule with a name remove-unused-variables
use:
import ruler from '@putout/cli-ruler';
import {
readFile,
writeFile,
} from 'node:fs/promises';
const places = [];
const options = {
enable: 'remove-unused-variables',
readFile,
writeFile,
};
await ruler(places, options);
It will produce .putout.json
:
{
"rules": {
"remove-unused-variables": "on"
}
}
Same with disable
.
License
MIT