@putout/cli-ruler
toggle rules in .putout.json
Last updated 3 years ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @putout/cli-ruler 
SYNC missed versions from official npm registry.

@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

Current Tags

  • 3.1.0                                ...           latest (a year ago)

6 Versions

  • 3.1.0                                ...           a year ago
  • 3.0.0                                ...           2 years ago
  • 2.0.0                                ...           3 years ago
  • 1.1.0                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Total 4
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (10)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE