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

linebreak-style without an argument seems to default to 'unix' #5628

Closed
denizdogan opened this issue Mar 20, 2016 · 3 comments
Closed

linebreak-style without an argument seems to default to 'unix' #5628

denizdogan opened this issue Mar 20, 2016 · 3 comments
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 documentation Relates to ESLint's documentation rule Relates to ESLint's core rules

Comments

@denizdogan
Copy link

I have a Git project which I contribute to on a Windows system. The general consensus seems to be that we should use core.autocrlf to deal with any line-ending issues that might arise. Therefore we need to configure ESLint (actually XO, which uses ESLint) to allow either CRLF line-endings or LF line-endings as long as we're being consistent.

I have a project which I've configured like this:

  "xo": {
    "esnext": true,
    "rules": {
      "linebreak-style": 2,
      "camelcase": 1,
      "no-useless-constructor": 1
    }
  }

Now I get this error for every single line of my project:

131:16 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style

The documentation talks about disallowing mixing of CRs and LFs, but it doesn't say explicitly whether my use case is supported. The test cases just leave me more confused, because their implementation seems to suggest that defaulting to LF-only is the intended behavior.

Is this a bug? How is this option meant to be used?

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Mar 20, 2016
@alberto
Copy link
Member

alberto commented Mar 20, 2016

Yes, by default, unix style (LF) is assumed, as mentioned in the options section, so it's not a bug.

There is no option to run this rule as consistent.

@alberto alberto closed this as completed Mar 20, 2016
@denizdogan
Copy link
Author

Okay, got it. The documentation is phrased in ways that imply that something like consistent was the original intent of the rule.

  1. The title says "Disallow mixing CRLF and LF". (I took this to mean within one file, not across multiple files...)
  2. The first code example gives the impression that by default the rule detects mixing of CRLF and LF within files, but what it does in this case is just detect CRLFs.
  3. "consistent line endings independent of operating system, VCS or editor used" - not really sure what the emphasized part is trying to clarify, maybe it could be replaced by "across multiple files"?

Maybe someone could look over the documentation and try to clarify the rule?

@alberto alberto added rule Relates to ESLint's core rules documentation Relates to ESLint's documentation accepted There is consensus among the team that this change meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Mar 20, 2016
@alberto
Copy link
Member

alberto commented Mar 20, 2016

Agreed.

@alberto alberto reopened this Mar 20, 2016
@alberto alberto self-assigned this Mar 20, 2016
ilyavolodin added a commit that referenced this issue Mar 20, 2016
Docs: Clarify `linebreak-style` docs (fixes #5628)
@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 documentation Relates to ESLint's documentation rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

3 participants