question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CLIEngine addPlugin function not working

See original GitHub issue

Tell us about your environment

  • ESLint Version: 6.0.1
  • Node Version: 12.4.0
  • npm Version: 6.9.0

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

Please show your full configuration:

Configuration
{
    "parserOptions": {
        "ecmaFeatures": {
            "jsx": true
        }
    },
    "globals": {
        "createReactClass": true
    },
    "plugins": ["react"],
    "extends": ["plugin:react/recommended"],
    "rules": {
        "react/jsx-wrap-multilines": [
            "error", {
                "declaration": "parens-new-line",
                "assignment": "parens-new-line",
                "return": "parens-new-line",
                "arrow": "parens-new-line",
                "condition": "parens-new-line",
                "logical": "parens-new-line",
                "prop": "parens-new-line"
            }
        ]
    }
}

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

I’m trying to merge a PR that updates our ESLint dependency from 5.x to 6.x. However, a test that adds react-eslint-plugin and formats React does not pass. If I add it via the plugins string array in the CLIEngine options it runs. PR I’m referring to is: https://github.com/Unibeautify/beautifier-eslint/pull/142.

I tried debugging, and the best I can tell additionalPluginPool isn’t used in the relevant functions (mainly executeOnText()).

      const cliOptions: CLIOptions = {
        baseConfig: {
          extends: extendsToAdd,
          globals: globals,
        },
        fix: true,
        parserOptions: parseOpts,
        rules: finalOptions,
        useEslintrc: false,
      };
      const cli: CLIEngine = new CLIEngine(cliOptions);
      cli.addPlugin("react", reactPlugin.package);
      const report: LintReport = cli.executeOnText(text);
      const result: LintResult = report.results[0];

What did you expect to happen? The plugin be used when added via addPlugin

What actually happened? Please include the actual, raw output from ESLint. I don’t see it using the plugin.

Are you willing to submit a pull request to fix this bug? If I need to

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:21 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
stevenzeckcommented, Jul 27, 2019

Yeah, to me this doesn’t make much sense. The point of addPlugin(), at least from the documentation, is to dynamically load a plugin to the CLIEngine without the need for the plugins property. At the very least it should have been documented as a breaking change with v6 despite it not working as designed prior.

0reactions
eslint-deprecated[bot]commented, Aug 27, 2019

It looks like the conversation is stalled here. As this is a question rather than an action item, I’m closing the issue. If you still need help, please send a message to our mailing list or chatroom. Thanks! [//]: # (auto-close)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why do I keep getting a parsing error with the ESLint ...
Right now, just to get things working, I am hard coding an HTML string into the cli.executeOnText() method. Here's the REST endpoint:
Read more >
JavaScript eslint CLIEngine.addPlugin Examples
Programming Language: JavaScript. Namespace/Package Name: eslint. Class/Type: CLIEngine. Method/Function: addPlugin. Examples at hotexamples.com: 2.
Read more >
eslint-plugin-vue
It's likely that the plugin isn't installed correctly. Try reinstalling by running the following: npm install eslint-plugin-vue@latest --save-dev The plugin " ...
Read more >
Migrating to v7.0.0 - ESLint - Pluggable JavaScript Linter
then running eslint src would check both *.js and *.ts files in the src ... This allows for users to utilize shared plugins...
Read more >
Node.js API - ESLint - Pluggable JavaScript linter
The most important method on Linter is verify() , which initiates linting of the ... nodeType - the node or token type that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found