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

@not-an-aardvark not-an-aardvark 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

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 added bug ESLint is working incorrectly core Relates to ESLint's core APIs and features accepted There is consensus among the team that this change meets the criteria for inclusion labels Oct 31, 2018
@not-an-aardvark not-an-aardvark merged commit 5525eb6 into master Nov 3, 2018
@not-an-aardvark not-an-aardvark deleted the fix-deprecation-warnings branch November 3, 2018 20:46
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators May 3, 2019
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label May 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly core Relates to ESLint's core APIs and features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants