You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On a Windows dev machine with a default git-for-windows setup (autocrlf true), running e.g. npm run serve will show lots of linting errors like the following:
...
125:10 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
For example, the default behavior of git on Windows systems is to convert LF linebreaks to CRLF when checking out files, but to store the linebreaks as LF when committing a change. This will cause the linebreak-style rule to report errors if configured with the "unix" setting, because the files that ESLint sees will have CRLF linebreaks. If you use git, you may want to add a line to your .gitattributes file to prevent git from converting linebreaks in .js files:
*.js text eol=lf
In our case we would also need to add *.ts and *.vue files, at least.
Instead of committing a .gitattributes file to the repo, this setting could also be specified in a .git/info/attributes file, so it only affects the local system.
In an existing clone of the repository, modifications to autocrlf or text will require a reset, as described e.g. here (make sure working dir is clean):
problem
On a Windows dev machine with a default git-for-windows setup (
autocrlf
true), running e.g.npm run serve
will show lots of linting errors like the following:possible solutions
The ESLint docs suggest adding a rule to
.gitattributes
to enforce LF linebreaks:In our case we would also need to add
*.ts
and*.vue
files, at least.Instead of committing a
.gitattributes
file to the repo, this setting could also be specified in a.git/info/attributes
file, so it only affects the local system.In an existing clone of the repository, modifications to
autocrlf
ortext
will require a reset, as described e.g. here (make sure working dir is clean):git rm -rf --cached . git reset --hard HEAD
where
-rf
stands for recursive and forcedAn alternative would be to add a rule to
.eslintrc.js
that sets thelinebreak-style
:Note that the eslint
linebreak-style
rule has been deprecated in favor of eslint stylistic:The text was updated successfully, but these errors were encountered: