sindresorhus/eslint-plugin-unicorn

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

sindresorhus posted onGitHub

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';

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

posted by IssueHuntBot about 6 years ago

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

posted by futpib about 6 years ago

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.

posted by sindresorhus about 6 years ago

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

posted by arshadkazmi42 about 6 years ago

If anyone wants to work on this, see the previous attempt and feedback: https://github.com/sindresorhus/eslint-plugin-unicorn/pull/232

posted by sindresorhus almost 5 years ago

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

  • :moneybag: Total deposit: $60.00
  • :tada: Repository reward(0%): $0.00
  • :wrench: Service fee(10%): $6.00
posted by issuehunt-app[bot] over 4 years ago

Fund this Issue

$60.00
Rewarded

Rewarded pull request

Other pull requests

Recent activities

futpib was rewarded by sindresorhus for sindresorhus/eslint-plugin-unicorn# 211
over 4 years ago