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

key-spacing fine-grained control issue #5479

Closed
DarkPark opened this issue Mar 5, 2016 · 4 comments
Closed

key-spacing fine-grained control issue #5479

DarkPark opened this issue Mar 5, 2016 · 4 comments
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules

Comments

@DarkPark
Copy link

DarkPark commented Mar 5, 2016

eslint v2.3.0

Rule:

"key-spacing": [1, {
    "singleLine": {
        "beforeColon": false, "afterColon": true, "mode": "strict"
    },
    "multiLine": {
        "beforeColon": false, "afterColon": true, "mode": "minimum"
    }
}],

Code:

module.exports = {
    foobar: 42,
    bat:    2 * 2
};

Expected result: no warnings.

Actual:

/home/dp/Projects/sdk/spa/plugin-css/index.js
  10:13  warning  Extra space before value for key 'bat'  key-spacing

✖ 1 problem (0 errors, 1 warning)

At the same time rule

"key-spacing": [1, {"beforeColon": false, "afterColon": true, "mode": "minimum"}],

gives no warnings
seems multiLine option is not working properly

@btmills btmills added bug ESLint is working incorrectly rule Relates to ESLint's core rules accepted There is consensus among the team that this change meets the criteria for inclusion labels Mar 5, 2016
@btmills
Copy link
Member

btmills commented Mar 5, 2016

Yeah, it looks like multiLine.mode isn't being applied correctly.

@btmills
Copy link
Member

btmills commented Mar 5, 2016

On line 373, isSingleLine is being passed a Property node, but it should be passed the ObjectExpression. @DarkPark want to submit a PR?

@DarkPark
Copy link
Author

DarkPark commented Mar 5, 2016

@btmills thanks, but I have not investigated the source code so it's better to be done by someone knowledgeable.

@platinumazure
Copy link
Member

@btmills I'll take it.

@btmills btmills closed this as completed in 38eb7f1 Mar 5, 2016
btmills added a commit that referenced this issue Mar 5, 2016
Fix: key-spacing checks ObjectExpression is multiline (fixes #5479)
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

3 participants