question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Code structure of "utilities" is inconsistent

See original GitHub issue

The modules that CLIEngine or Linter depend on are sometimes stored in inconsistent locations (at least, it seems that way to me).

At this point, it can be hard to see a consistent difference between files stored in lib/, vs files stored in lib/util/. That is, in both directories, we can see both “core” and “utility” modules. I would like to see if we could store only “core” modules in lib/, and only “utility” modules in lib/util/. (The rule of thumb I would use for what constitutes a “core” module is as follows: Anything important enough to document in our Node.js API documentation page, or anything directly called by CLIEngine or Linter that performs a key piece of linting, should probably be “core” and should probably be in lib/.)

I think it could help new contributors find their way around the codebase better if we try to be more consistent about placing core modules in lib/ and utility modules in lib/util/.

Some examples of modules that I think should be moved from lib/ to lib/util/:

  • lib/ast-utils.js: This is used by many rules, but it is not a strategic part of our API. I think this should be in lib/util.
  • lib/file-finder.js: This is used in the config file operations for helping find files on the filesystem. Config APIs themselves (e.g., in lib/config.js) should be “core” and be in the lib directory, but I think this file should be in lib/util.
  • lib/logging.js: This is clearly not a core module, but rather something used for internal logging only. Should be in lib/util.
  • lib/timing.js: This is clearly not a core module, but rather something to help with performance testing only.

(I do think there could be other modules on this list, especially around rule management, but this is a good start.)

Some examples of modules that I think should be moved from lib/util/ to lib/:

  • lib/util/rule-fixer.js: This API is used in all core and custom rules that support autofixing, which is a key component of the linter.
  • lib/util/source-code-fixer.js: This code is a key part of tracking and applying autofixes, which is a key component of the linter.

Would love to get feedback from the rest of the team on this.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
aladdin-addcommented, Jul 26, 2018

what about lib/ast-utils.js => lib/util/ast-utils.js? if so, all utils will be in lib/util/ dir.

and personally I’d like to rename ast-utils.js => ast-util.js, so it could be consistent to other util, like npm-util.js, path-util.js.

0reactions
eslint-deprecated[bot]commented, Dec 15, 2018

Unfortunately, it looks like there wasn’t enough interest from the team or community to implement this change. While we wish we’d be able to accommodate everyone’s requests, we do need to prioritize. We’ve found that accepted issues failing to be implemented after 90 days tend to never be implemented, and as such, we close those issues. This doesn’t mean the idea isn’t interesting or useful, just that it’s not something the team can commit to.

Thanks for contributing to ESLint and we appreciate your understanding.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Utilities messages (CSQU...) - IBM
The page set is in an inconsistent state and so the stand-alone utility functions cannot process it. The function is terminated.
Read more >
chapter 39. restructuring of electric utility industry
UTILITIES CODE. TITLE 2. PUBLIC UTILITY REGULATORY ACT. SUBTITLE B. ELECTRIC UTILITIES. CHAPTER 39. RESTRUCTURING OF ELECTRIC UTILITY INDUSTRY.
Read more >
Solving the rate puzzle: The future of electricity rate design
Utilities can meet distinct customer needs with a menu of options instead of a single, undifferentiated tariff as seen in the exhibit below, ......
Read more >
Electricity Regulation In the US: A Guide
Consumer-owned utilities (COUs) typically have very different regulatory structures. City utilities (“municipals” or “munis”) are generally subject to control ...
Read more >
Chapter 15.39 UTILITY REQUIREMENTS
(1) As a condition of any new development or redevelopment, new and existing utilities shall be installed or relocated underground consistent with the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found