Skip to content

[no-restricted-imports] No way to use this rule with import = require() syntax. #2563

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

Closed
3 tasks done
rtruong opened this issue Sep 14, 2020 · 2 comments · Fixed by #7709
Closed
3 tasks done

[no-restricted-imports] No way to use this rule with import = require() syntax. #2563

rtruong opened this issue Sep 14, 2020 · 2 comments · Fixed by #7709
Labels
accepting prs Go ahead, send a pull request that resolves this issue enhancement: new base rule extension New base rule extension required to handle a TS specific case package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@rtruong
Copy link

rtruong commented Sep 14, 2020

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro

{
  "rules": {
    "no-restricted-imports": [
      "error",
      {
        paths: ["lodash"],
      },
    ],
  }
}
import _ = require("lodash");

Expected Result

Should result in a linting error.

Actual Result

No errors.

Additional Info

Versions

package version
@typescript-eslint/eslint-plugin 4.1.0
@typescript-eslint/parser 4.1.0
@typescript-eslint/typescript-estree 4.1.0
@typescript-eslint/experimental-utils 4.1.0
TypeScript 3.5.2
node 12.16.3
npm 6.14.7
@bradzacher bradzacher added enhancement: new base rule extension New base rule extension required to handle a TS specific case package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin labels Sep 14, 2020
@bradzacher
Copy link
Member

See related request: #2403

@JoshuaKGoldberg JoshuaKGoldberg added the accepting prs Go ahead, send a pull request that resolves this issue label Oct 25, 2021
@JoshuaKGoldberg JoshuaKGoldberg added the breaking change This change will require a new major version to be released label Oct 8, 2023
@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commented Oct 8, 2023

Taking another look, I'm pretty sure this is actually a breaking change 🤔. Some users might be relying on the gap in rule coverage to import from restricted paths with import = require().

Never mind, I'm convinced to treat this as a bugfix. 🙂

@JoshuaKGoldberg JoshuaKGoldberg removed the breaking change This change will require a new major version to be released label Oct 17, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue enhancement: new base rule extension New base rule extension required to handle a TS specific case package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants