@putout/cli-ruler

3.1.0 • Public • Published

@putout/cli-ruler NPM version

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

Readme

Keywords

Package Sidebar

Install

npm i @putout/cli-ruler

Weekly Downloads

6,809

Version

3.1.0

License

MIT

Unpacked Size

6.11 kB

Total Files

5

Last publish

Collaborators

  • coderaiser