Giter Club home page Giter Club logo

Comments (5)

willhoney7 avatar willhoney7 commented on July 27, 2024 1

Hi! I'm so happy to hear this has been useful to you!

Regarding, external and internal, yes I dropped that because supporting it required attempting to resolve the imports and do things beyond looking at the actual import path string. It was a lot of work for minimal gain.

Regarding builtin, it seems unnecessary since you can replicate the exact functionality with regular expression groups. I think it's more of a special case than a "standard" group. See the migration guide on the regular expression.

I'm absolutely open to adding it back in the future if enough people want it. However, being able to still support it with a RegEx makes me lean towards keeping it out. Plus this way you can keep the list up to date and manage it yourself (I don't have to update this rule to support the next version of node, etc).

from eslint-plugin-import-helpers.

lffg avatar lffg commented on July 27, 2024

I see...

Thanks for the reply. :)

from eslint-plugin-import-helpers.

ezhlobo avatar ezhlobo commented on July 27, 2024

@Tibfib hey, just want to add my words to this. I think keeping builtin is important, otherwise we have to write absolutely the same regexp all the time.

from eslint-plugin-import-helpers.

willhoney7 avatar willhoney7 commented on July 27, 2024

@ezhlobo Apologies for the very late response on this.

All the time is pretty exaggerated I think. This ESLint rule isn't something you have to set up/edit every day... maybe every couple of months. In that case, copy and pasting that regexp doesn't seem to be a huge deal.

And, as I said earlier, this way requires less maintenance and updates to this rule.

Plus this way you can keep the list up to date and manage it yourself (I don't have to update this rule to support the next version of node, etc).

from eslint-plugin-import-helpers.

lffg avatar lffg commented on July 27, 2024

I ended up doing something like this:

const builtInModules = require('builtin-modules');

module.exports = {
  rules: {
    'import-helpers/order-imports': [
      WARN,
      {
        groups: [
          [`/^(${builtInModules.join('|')})$/`],
          // Other groups... :)
        ],
        alphabetize: { order: 'asc', ignoreCase: true },
        newlinesBetween: 'never'
      }
    ]
  }
};

The module builtin-modules returns an array containing all Node.js built in modules.

from eslint-plugin-import-helpers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.