Socket
Socket
Sign inDemoInstall

@putout/cli-ruler

Package Overview
Dependencies
1
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @putout/cli-ruler

toggle rules in .putout.json


Version published
Weekly downloads
5K
increased by0.2%
Maintainers
1
Install size
11.0 kB
Created
Weekly downloads
 

Readme

Source

@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

Keywords

FAQs

Last updated on 27 Aug 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc