feat(max-attributes-per-line): singleline.allowFirstLine option #1465
+69
−15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What rule do you want to change?
max-attributes-per-line
Does this change cause the rule to produce more or fewer warnings?
More
How will the change be implemented? (New option, new default behavior, etc.)?
Lower the minimum value on
singleline
/singleline.max
to 0 on the schema.Update:
Add a
singleline.allowFirstLine
option that defaults totrue
, but prevents single attributes from being on the same line if set tofalse
.Please provide some example code that this change will affect:
When setting
singleline.max = 0
, the following should be marked incorrect:Update:
When setting
singleline.allowFirstLine = false
, the following should be marked incorrect:What does the rule currently do for this code?
Currently, can't set
singleline
to 0 because of the schema validation.What will the rule do after it's changed?
Correct it to:
Additional context
This was working in prior versions of ESLint that did not enforce the JSON schema on options. But since upgrading ESLint, this appeared to be a regression. Since it's not a regression in this plugin, I labeled this as a feature request.
This is style used by a large codebase I'm contributing to.