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

Wrong output indentation in all messages if one message has a long multiline quote #6340

Closed
vsemozhetbyt opened this issue Jun 8, 2016 · 5 comments · Fixed by #6360
Closed
Assignees
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

@vsemozhetbyt
Copy link
Contributor

vsemozhetbyt commented Jun 8, 2016

What version of ESLint are you using?

2.11.1

What parser (default, Babel-ESLint, etc.) are you using?

default

Please show your full configuration:

{
  "root": true,

  "extends": [
    "eslint:recommended",
    "airbnb-base"
  ],

  "parserOptions": {
    "ecmaVersion": 7,
    "sourceType": "script"
  },

  "env": {
    "browser": false,
    "es6": true,
    "node": true
  },

  "rules": {
    "arrow-parens": [2, "as-needed"],
    "eqeqeq": 2,
    "key-spacing": [2, { "beforeColon": false, "afterColon": true, "mode": "minimum" }],
    "no-console": 0,
    "no-eq-null": 2,
    "no-extra-parens": [2, "all"],
    "no-multi-spaces": 0,
    "no-unused-vars": 2,
    "no-use-before-define": [2, { "functions": false }],
    "quotes": [2, "single"],
    "spaced-comment": [2, "always", { "exceptions": ["/", "*"] }],
    "strict": [2, "global"],
    "unicode-bom": [2, "always"]
  }
}

What did you do? Please include the actual source code causing the issue.

const http = require('http');

http.request({
  // Param
  // Param
  // Param
}).on('response', response => {
  // Do something with response.
  // Do something with response.
  // Do something with response.
  // Do something with response.
  // Do something with response.
  // Do something with response.
  // Do something with response.
  // Do something with response.
  // Do something with response.
  // Do something with response.
}).on('error', error => {
  // Do something with error.
  // Do something with error.
  // Do something with error.
  // Do something with error.
  // Do something with error.
  // Do something with error.
  // Do something with error.
  // Do something with error.
  // Do something with error.
  // Do something with error.
}).end();

What did you expect to happen?

An output with readable indentation and alignment.

What actually happened? Please include the actual, raw output from ESLint.

1

Compare with the output after the last error fixed:

2

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Jun 8, 2016
@platinumazure
Copy link
Member

This is a formatter-specific issue. Other formatters may work better for you.

Please see the formatter CLI option docs for more options.

@vsemozhetbyt
Copy link
Contributor Author

vsemozhetbyt commented Jun 8, 2016

@platinumazure Thank you. However, it seems to be a rather generic problem to be considered for the default formatter. When it appears, it is more easier to correct the error causing quote then to change the formatter. However, the quote in the end of a message queue has an impact on all the queue and should be located and addressed first — and this is somewhat inconvenient.

@ilyavolodin ilyavolodin added bug ESLint is working incorrectly rule Relates to ESLint's core rules evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Jun 8, 2016
@ilyavolodin
Copy link
Member

It looks like a bug that we should fix. However, I don't think we should fix formatter itself, but instead we should modify newline-per-chained-call to not dump that much information into the error message.

@mysticatea
Copy link
Member

I will work on this.

Just curious about this is intentional behavior?

/*eslint newline-per-chained-call:2*/

const http = require('http');

http.request({
}).on('response', response => {  // NO ERROR at this `.on`.
}).on('error', error => {        // error at this `.on`
}).end();                        // error at `.end`

Why is the first .on not warned?
Or, actually those all are false positive?

@mysticatea mysticatea added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Jun 9, 2016
@mysticatea mysticatea self-assigned this Jun 9, 2016
@mysticatea
Copy link
Member

Ah OK.
Default allows 2 chained and disallows 3rd and later.

@vsemozhetbyt vsemozhetbyt changed the title Wrong output indentation in all messages if one massage has a long multiline quote Wrong output indentation in all messages if one message has a long multiline quote Jun 28, 2016
@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

Successfully merging a pull request may close this issue.

5 participants