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

Rule proposal: Don't import util Node.js core module directly #211

Closed
sindresorhus opened this issue Jan 20, 2019 · 6 comments · Fixed by #789
Closed

Rule proposal: Don't import util Node.js core module directly #211

sindresorhus opened this issue Jan 20, 2019 · 6 comments · Fixed by #789
Labels
enhancement 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt help wanted

Comments

@sindresorhus
Copy link
Owner

sindresorhus commented Jan 20, 2019

Issuehunt badges

This module is the perfect case for using destructuring / named imports, as it's just a bunch of unrelated functions.

Fail

const util = require('util');
import util from 'util';
import * as util from 'util';

Pass

const {promisify} = require('util');
import {promisify} from 'util';

IssueHunt Summary

futpib futpib has been rewarded.

Backers (Total: $60.00)

Submitted pull Requests


Tips

@IssueHuntBot
Copy link

@issuehuntfest has funded $60.00 to this issue. See it on IssueHunt

@futpib
Copy link
Contributor

futpib commented Jan 24, 2019

Instead of being utils-specific why not make it accept a set of modules as an option (with utils being among defaults)?

@sindresorhus
Copy link
Owner Author

sindresorhus commented Jan 24, 2019

Good idea! Let’s do that. We could add lodash and underscore to the default list too. Maybe we could also have a list for the inverse? For example, chalk should not be destructured, but people still do. Same with the core path module.

@arshadkazmi42
Copy link

@sindresorhus I would like to work on this.
Can you provide some more details what is the finalize approach for this?

rahgurung added a commit to rahgurung/eslint-plugin-unicorn that referenced this issue Feb 2, 2019
@issuehunt-oss issuehunt-oss bot added the 💵 Funded on Issuehunt This issue has been funded on Issuehunt label May 10, 2019
@sindresorhus
Copy link
Owner Author

If anyone wants to work on this, see the previous attempt and feedback: #232

@issuehunt-oss issuehunt-oss bot removed the 💵 Funded on Issuehunt This issue has been funded on Issuehunt label Jul 30, 2020
@issuehunt-oss
Copy link

issuehunt-oss bot commented Jul 30, 2020

@sindresorhus has rewarded $54.00 to @futpib. See it on IssueHunt

  • 💰 Total deposit: $60.00
  • 🎉 Repository reward(0%): $0.00
  • 🔧 Service fee(10%): $6.00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt help wanted
Projects
None yet
4 participants