-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Support separate requires in one-var #6175
Support separate requires in one-var #6175
Comments
I'm not in favor of adding a CommonJS-specific option to a general rule, so I'm 👎 On this suggestion. |
Looks like there's already a lengthy discussion of this here: #4680 So closing as a duplicate. |
I reopened this since this matter was separated from #4680. |
@mysticatea is this part of JSCS work? |
Yes, requireMultipleVarDecl seems to have an exception for |
Having a little trouble tracing all the issues about this - where does this stand, @mysticatea? Is the original proposal still what we want to implement? If so, I'll champion this. Edit: I think the option name should be camel case since it's an object key: |
@mysticatea Friendly ping |
I'm sorry for too late! I think, yes. (Though, it seems |
Right. Honestly, not sure how to proceed with this. I think your suggestion makes more sense, but it is different than what the JSCS option does. Seems like what |
@eslint/eslint-team Thoughts on this? Had a request for this in the Gitter chat today and would like to support this for those who are converting from JSCS. The big remaining question is whether we track the JSCS ignore behavior or implement the separate |
I agree, having an option to separate |
👍 on this |
Can we get some JSCS folks input here? |
I'm for the JSCS behavior, considering it's more lenient, makes switching from JSCS easier, and we can always add the stricter version later. That said, I'm fine either way. |
@eslint/eslint-team Sounds like we have 4 (including myself) in favor of the separate |
Don't let my opinion hold this back from moving forward. |
I will take a look into getting a PR up for this sometime this week/weekend. |
@mikeletscher Fantastic! Please feel free to visit us in the ESLint Gitter if you get stuck or want to chat! |
@mikeletscher are you still working on this? I'm planning to make a PR this weekend if it's ok for you. |
@onurtemizkan Was like 2/3 of the way done, but don't let me stop you! |
@mikeletscher No! Please go for it |
Hey guys, I dropped the ball on this--didn't end up having the time to finish it. @onurtemizkan I don't want to block you if you wanted to get this fixed, sorry for following up so late! |
ESLint Version: 2.10.1
Problem:
A common request (e.g, #3091, #1232) is for the
one-var
rule to properly function in tandem withno-mixed-requires
. I agree with this opinion, as the two methods are part of the core set of rules provided with ESLint and should properly support each other. I also believe there is a way to support this without introducing a dependency between the two rules.Recommended Solution:
I believe this should not be a plugin, as both commands are part of the core library and cause conflict with each other. A better solution would be to add an optional parameter
separate-requires
toone-var
that allows forrequire
keywords to be separated into a single block, while assignments are in another block (similar to the intent of the two-var plugin).For example:
This will allow ESLint to properly support it's built-in plugins without changing the default functionality of the
one-var
rule. With the above configuration:This code would result in an error:
This code would be valid:
The text was updated successfully, but these errors were encountered: