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 setting suggestion: "allow-invoked" with no-mixed-requires [$25] #4011

Closed
indexzero opened this Issue Oct 2, 2015 · 10 comments

Comments

Projects
None yet
4 participants
@indexzero
Copy link

indexzero commented Oct 2, 2015

Read through open and closed issues about no-mixed-requires and didn't see anything like this. Would allow syntax like this:

var async = require('async'),
    debug = require('diagnostics')('my-module'),
    eslint = require('eslint');

But still disallow all mixed constants,etc. Currently the work around for this is to simply put the immediately computed result in a separate var statement:

var async = require('async'),
    eslint = require('eslint');

var debug = require('diagnostics')('my-module');

Did you help close this issue? Go claim the $25 bounty on Bountysource.

@eslintbot

This comment has been minimized.

Copy link

eslintbot commented Oct 2, 2015

Thanks for the issue! If you're reporting a bug, please be sure to include:

  1. The version of ESLint you are using (run eslint -v)
  2. What you did (the source code and ESLint configuration)
  3. The actual ESLint output complete with numbers
  4. What you expected to happen instead

Requesting a new rule? Please see Proposing a New Rule for instructions.

@eslintbot eslintbot added the triage label Oct 2, 2015

@nzakas nzakas added enhancement rule accepted and removed triage labels Oct 3, 2015

@nzakas

This comment has been minimized.

Copy link
Member

nzakas commented Oct 3, 2015

I think we need to think through the name of the option a bit, but seems like a good idea. Do you want to submit a pull request?

@indexzero

This comment has been minimized.

Copy link
Author

indexzero commented Oct 3, 2015

I'll take a stab at it, could be tricky though.

@nzakas nzakas added the help wanted label Oct 5, 2015

@nzakas nzakas changed the title Rule setting suggestion: "allow-invoked" with no-mixed-requires Rule setting suggestion: "allow-invoked" with no-mixed-requires [$25] Dec 27, 2015

@nzakas nzakas added the bounty label Dec 27, 2015

@rpatil26

This comment has been minimized.

Copy link
Contributor

rpatil26 commented Jan 2, 2016

@indexzero - Are you looking at this? If not, I was thinking to give it a try. The option name I am thinking of is "allowInvocation". The options have been camelCase and let's keep it consistent with that practice.

@rpatil26

This comment has been minimized.

Copy link
Contributor

rpatil26 commented Jan 2, 2016

@indexzero - One more question. With this new option true, would following be considered a problem? If so, then it would be tricky.

var async = require('async'),
    debug = require('diagnostics').someFunction('my-module'),
    eslint = require('eslint');
@nzakas

This comment has been minimized.

Copy link
Member

nzakas commented Jan 2, 2016

I'd shorten it to allowCall and would not allow that code.

@rpatil26

This comment has been minimized.

Copy link
Contributor

rpatil26 commented Jan 2, 2016

Ok, I'll name it allowCall.

Let me explore it more to allow require('module')('nested'), but not require('module').someFn('param')

ilyavolodin added a commit that referenced this issue Jan 3, 2016

Merge pull request #4847 from rpatil26/issue4011
Update: Add "allowCall" option (fixes #4011)

lencioni added a commit to lencioni/eslint that referenced this issue Jan 3, 2016

Update: Add "allowCall" option (fixes eslint#4011)
Add new option “allowCall” to support nested invocation.
@indexzero

This comment has been minimized.

Copy link
Author

indexzero commented Jan 4, 2016

Great work @rpatil26.

@rpatil26

This comment has been minimized.

Copy link
Contributor

rpatil26 commented Jan 4, 2016

Thanks @indexzero. Looking forward to more contributions.

@nzakas

This comment has been minimized.

Copy link
Member

nzakas commented Jan 4, 2016

@rpatil26 be sure to claim your bounty for this issue.

@eslint eslint bot locked and limited conversation to collaborators Feb 7, 2018

@eslint eslint bot added the archived due to age label Feb 7, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.