Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: rule deprecation warnings did not consider all rules #11044

Merged
merged 2 commits into from Nov 3, 2018

Conversation

@not-an-aardvark
Copy link
Member

commented Oct 31, 2018

What is the purpose of this pull request? (put an "X" next to item)

[x] Bug fix

Tell us about your environment

  • ESLint Version: master
  • Node Version: 11.0.0
  • npm Version: 6.4.1

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

N/A

Please show your full configuration:

N/A

What did you do? Please include the actual source code causing the issue.

From within the ESLint repository:

const CLIEngine = require(".").CLIEngine;
const cliEngine = new CLIEngine();

console.log(cliEngine.executeOnFiles(["Makefile.js"]));

Ran eslint Makefile.js --format json in the ESLint repository

What did you expect to happen?

I expected the output to contain a usedDeprecatedRules property indicating that the no-catch-shadow rule (which we enable in eslint-config-eslint) has been replaced by no-shadow.

What actually happened? Please include the actual, raw output from ESLint.

{ results:
   [ { filePath: '/path/to/eslint/Makefile.js',
       messages: [],
       errorCount: 0,
       warningCount: 0,
       fixableErrorCount: 0,
       fixableWarningCount: 0 } ],
  errorCount: 0,
  warningCount: 0,
  fixableErrorCount: 0,
  fixableWarningCount: 0,
  usedDeprecatedRules: [] }

What changes did you make? (Give an overview)

This fixes a bug where rule deprecation warnings would only be generated for rules passed via the --rule flag on the command line, rather for all rules configured in a config file. It also addresses an issue where passing a nonexistent rule on the command line would cause CLIEngine to crash, which broke the eslint-canary build.

Additionally, usedDeprecatedRules was only appearing on the result of CLIEngine#executeOnFiles before. I updated it to also appear on the result of CLIEngine#executeOnText, since the two functions are documented to have the same output format.

Is there anything you'd like reviewers to focus on?

Nothing in particular

Fix: rule deprecation warnings did not consider all rules
This fixes a bug where rule deprecation warnings would only be generated for rules passed via the `--rule` flag on the command line, rather for all rules configured in a config file. It also addresses an issue where passing a nonexistent rule on the command line would cause CLIEngine to crash, which broke the eslint-canary build.

@not-an-aardvark not-an-aardvark merged commit 5525eb6 into master Nov 3, 2018

5 checks passed

commit-message PR title follows commit message guidelines
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
licence/cla Contributor License Agreement is signed.
Details
release-monitor No patch release is pending
Details

@not-an-aardvark not-an-aardvark deleted the fix-deprecation-warnings branch Nov 3, 2018

@eslint eslint bot locked and limited conversation to collaborators May 3, 2019

@eslint eslint bot added the archived due to age label May 3, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants
You can’t perform that action at this time.