Skip to content

Can't get plugin rules added by cli.addPlugin #12425

@fisker

Description

@fisker

Tell us about your environment

  • ESLint Version: 6.5.1
  • Node Version: 10.16.3
  • npm Version: 6.9.0

What parser (default, Babel-ESLint, etc.) are you using?

default

const {CLIEngine} = require('eslint')
const unicorn = require('eslint-plugin-unicorn')
const cli = new CLIEngine()
cli.addPlugin('eslint-plugin-unicorn', require('eslint-plugin-unicorn'))
console.log(cli.getRules().has('unicorn/no-process-exit'))

I can't get the plugin rules, Is this by design or a bug?


quick reproduction

md eslint-issues-12425 && cd eslint-issues-12425 && yarn init -y && yarn add eslint eslint-plugin-unicorn

# print true
node -p "new (require('eslint').CLIEngine)({plugins: ['unicorn']}).getRules().has('unicorn/no-process-exit')"

# print false, but should be true
node -p "const cli = new (require('eslint').CLIEngine);cli.addPlugin('eslint-plugin-unicorn', require('eslint-plugin-unicorn'));cli.getRules().has('unicorn/no-process-exit')"

Metadata

Metadata

Assignees

Labels

acceptedThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussionbugESLint is working incorrectlycoreRelates to ESLint's core APIs and features

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions