Skip to content
This repository was archived by the owner on Mar 7, 2019. It is now read-only.
This repository was archived by the owner on Mar 7, 2019. It is now read-only.

Rule to check module.exports consistency #16

@hohy

Description

@hohy

I would like to have a eslint rule that checks if the modules are exported in consistent way in all modules.

Now you can export functions in one module like this:

// first you declare and implement all the functions
function findById() { ... do something ...}
function findAll() {}
function incrementViews() {}

module.exports = {    // and then all the functions are exported at once
  findById,
  findAll,
  incrementViews
}

and in other module, you can export functions directly when declaring them:

// export the function with the implementation in one line
module.exports.findById = function findById() {
   ... do something ...
}

module.exports.findAll = function findAll() {
   ... do something ...
}

module.exports.incrementViews = function incrementViews() {
   ... do something ...
}

I'm not sure if this kind of rule exists in eslint, but I think it would be nice to have it and this rule would be more important than checking if a comment starts with capital letter 😜

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions