Skip to content

chore(eslint-plugin): deprecate no-var-requires in favor of no-require-imports #8334

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

Merged
merged 35 commits into from
May 28, 2024

Conversation

arkapratimc
Copy link
Contributor

@arkapratimc arkapratimc commented Feb 1, 2024

BREAKING CHANGE:
Deprecates a previously-recommended rule.

PR Checklist

Overview

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @arka1002!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint.

Copy link

netlify bot commented Feb 1, 2024

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 05956d8
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/6655440a76e36d0008d37ef9
😎 Deploy Preview https://deploy-preview-8334--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 99 (🟢 up 1 from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (no change from production)
SEO: 98 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@arkapratimc arkapratimc marked this pull request as draft February 1, 2024 12:41
@arkapratimc arkapratimc marked this pull request as ready for review February 1, 2024 13:45
@arkapratimc arkapratimc marked this pull request as draft February 1, 2024 14:07
@arkapratimc
Copy link
Contributor Author

Hi, I just have one doubt, just to make sure I understood the problem correctly

In no-require-imports if we set allowAsImport as true, then all the test cases in no-var-requires will pass right ??

example -

/* eslint "@typescript-eslint/no-require-imports": ["error", { "allowAsImport": true } ] */
import foo = require("foo"); // no error (??)

@arkapratimc arkapratimc marked this pull request as ready for review February 1, 2024 14:45
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Mostly solid! A bit around config recommendations & unit tests, and this'll be good to go...

...once v7 v8 is ready to go. Which will be in a few months. So this'll have to wait 😅. But thanks in the interim!

@JoshuaKGoldberg JoshuaKGoldberg added breaking change This change will require a new major version to be released awaiting response Issues waiting for a reply from the OP or another party labels Feb 3, 2024
arkapratimc and others added 3 commits February 6, 2024 20:45
@github-actions github-actions bot removed the awaiting response Issues waiting for a reply from the OP or another party label Feb 8, 2024
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Progress!

Note that I retargeted this against the v8 branch.

options: [{ allowAsImport: true }],
},
{
code: 'require(foo);',
Copy link
Member

Choose a reason for hiding this comment

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

🤔 I'm not positive that this should be allowed with allowAsImport. There's no import() in there. The intersection of folks using import = syntax and needing to require() in globals and using this rule seems pretty low to me. Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@JoshuaKGoldberg JoshuaKGoldberg changed the base branch from main to v8 March 18, 2024 11:50
@JoshuaKGoldberg JoshuaKGoldberg added the awaiting response Issues waiting for a reply from the OP or another party label Mar 18, 2024
JoshuaKGoldberg and others added 3 commits April 15, 2024 11:20
typescript-eslint#8920)

* fix(typescript-estree): add TSEnumBody node for TSEnumDeclaration body

* Fixed up tests and their snapshots

* More about enums

* Indent too

* Update packages/ast-spec/src/special/TSEnumBody/spec.ts

Co-authored-by: Brad Zacher <brad.zacher@gmail.com>

* parent types touchups

* Update packages/visitor-keys/src/visitor-keys.ts

Co-authored-by: Brad Zacher <brad.zacher@gmail.com>

---------

Co-authored-by: Brad Zacher <brad.zacher@gmail.com>
Copy link

codecov bot commented Apr 16, 2024

Codecov Report

Attention: Patch coverage is 84.61538% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 87.32%. Comparing base (ae1414c) to head (9283877).

Current head 9283877 differs from pull request most recent head 05956d8

Please upload reports for the commit 05956d8 to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##               v8    #8334      +/-   ##
==========================================
- Coverage   87.42%   87.32%   -0.11%     
==========================================
  Files         386      252     -134     
  Lines       13094    12438     -656     
  Branches     3788     3918     +130     
==========================================
- Hits        11448    10862     -586     
+ Misses       1354     1305      -49     
+ Partials      292      271      -21     
Flag Coverage Δ
unittest 87.32% <84.61%> (-0.11%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...ackages/eslint-plugin/src/rules/no-var-requires.ts 100.00% <ø> (ø)
...ages/eslint-plugin/src/rules/no-require-imports.ts 93.33% <84.61%> (-6.67%) ⬇️

... and 250 files with indirect coverage changes

@JoshuaKGoldberg JoshuaKGoldberg added the awaiting response Issues waiting for a reply from the OP or another party label Apr 23, 2024
arkapratimc and others added 2 commits April 25, 2024 23:04
Co-authored-by: Josh Goldberg ✨ <git@joshuakgoldberg.com>
@github-actions github-actions bot removed the awaiting response Issues waiting for a reply from the OP or another party label Apr 27, 2024
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Swell, thanks! Looks great to me. Thanks for making the changes 🙂

Leaving with 1 approval, since @auvred was reviewing too.

@JoshuaKGoldberg JoshuaKGoldberg added the 1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge label May 26, 2024
@JoshuaKGoldberg JoshuaKGoldberg added this to the 8.0.0 milestone May 26, 2024
arkapratimc and others added 3 commits May 26, 2024 16:57
Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
@arkapratimc
Copy link
Contributor Author

The tests which failed in this pr, failed in the v8 branch too ? c0bf6fc , see the CI check in this commit.

@arkapratimc arkapratimc requested a review from Josh-Cena May 26, 2024 12:18
@bradzacher bradzacher merged commit d97366e into typescript-eslint:v8 May 28, 2024
60 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge breaking change This change will require a new major version to be released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Repo: deprecate no-var-requires in favor of no-require-imports
6 participants