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

chore: duplicate eslint rules locally to allow warning #10579

Merged
merged 1 commit into from
Oct 4, 2020
Merged

chore: duplicate eslint rules locally to allow warning #10579

merged 1 commit into from
Oct 4, 2020

Conversation

G-Rath
Copy link
Contributor

@G-Rath G-Rath commented Oct 4, 2020

Summary

See this comment.

Test plan

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay, thanks!

@@ -9,4 +9,6 @@ exports.rules = {
'ban-types-eventually': require('@typescript-eslint/eslint-plugin').rules[
'ban-types'
],
'prefer-rest-params-eventually': require('eslint/lib/rules/prefer-rest-params'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So these exist off of require('eslint') instead of the deep import?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean "do"?

If so then, no they don't - because eslint is the "core", it doesn't export its rules in the same way plugins do, so you can't do require('eslint').rules['<rule>'].

In fact, it doesn't export its rules at all:

❯ node
Welcome to Node.js v14.4.0.
Type ".help" for more information.
> require('eslint')
{
  Linter: [Function: Linter],
  CLIEngine: [Function: CLIEngine] {
    version: '7.8.1',
    getFormatter: [Function: getFormatter]
  },
  ESLint: [Function: ESLint],
  RuleTester: [Function: RuleTester] {
    [Symbol(it)]: null,
    [Symbol(describe)]: null
  },
  SourceCode: [Function: SourceCode]
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@SimenB SimenB merged commit ad29e80 into jestjs:master Oct 4, 2020
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants