configured-eslint-rules

6.0.1 • Public • Published

configured-eslint-rules

npm version GitHub Actions codecov

Detect configured ESLint rules

/*
    ./eslintrc.json:
 
    {
      "rules": {
        "no-alert": 2,
        "no-array-constructor": 1,
        "no-bitwise": 0,
        "linebreak-style": [2, "unix"],
      }
    }
*/
 
const configuredESLintRules = require('configured-eslint-rules');
const configured = configuredESLintRules();
//=> ['no-alert', 'no-array-constructor', 'no-bitwise', 'linebreak-style']

Installation

Use npm.

npm install configured-eslint-rules

API

const configuredEslintRules = require('configured-eslint-rules');

configuredEslintRules([options])

options: Object | CLIEngine
Return: string[]

It returns an Array of the ESLint rule names that have rule configurations on a current working directory.

The optional parameter accepts either a plain Object to set CLIEngine options or an already instantiated CLIEngine, and affects the result.

/*
    ./eslintrc.yml:
 
    rules:
      eqeqeq: 1
*/
 
configuredEslintRules(); //=> ['eqeqeq']
 
configuredEslintRules({rules: {curly: 0}}); //=> ['eqeqeq', 'curly']

License

ISC License © 2018 - 2019 Watanabe Shinnosuke

Package Sidebar

Install

npm i configured-eslint-rules

Weekly Downloads

15

Version

6.0.1

License

ISC

Unpacked Size

4.4 kB

Total Files

4

Last publish

Collaborators

  • shinnn