Closed handhikadj closed 5 years ago
Hi! Can you make a repo that I can clone and run to reproduce the issue?
Closing due to inactivity. Feel free to leave a comment if you find anything!
sorry for making you waiting thus this issue was closed
here it is: https://github.com/handhikadj/eslint-bug-report
i'm using vscode with plugins: eslint, prettier, and vetur. prettier seems to work however, do you know why do every time I hit save (CTRL + S) double quote is changed to single quote and vice versa?
Thanks! What are the steps to reproduce your issue?
resources/js
eslint --fix [jsfile]
on terminal you can see the errorThanks. I tried to follow your steps, but couldn't reproduce.
~/stuff
❯ git clone git@github.com:handhikadj/eslint-bug-report.git
Cloning into 'eslint-bug-report'...
remote: Enumerating objects: 124, done.
remote: Counting objects: 100% (124/124), done.
remote: Compressing objects: 100% (96/96), done.
remote: Total 124 (delta 9), reused 124 (delta 9), pack-reused 0
Receiving objects: 100% (124/124), 347.74 KiB | 749.00 KiB/s, done.
Resolving deltas: 100% (9/9), done.
~/stuff
❯ cd eslint-bug-report/
~/stuff/eslint-bug-report master
❯ npm ci
> fsevents@1.2.7 install /home/lydell/stuff/eslint-bug-report/node_modules/fsevents
> node install
added 1181 packages in 8.966s
~/stuff/eslint-bug-report 9s master
❯ touch resources/js/foo.js
~/stuff/eslint-bug-report master %
❯ node_modules/.bin/eslint --fix resources/js/foo.js
~/stuff/eslint-bug-report master %
❯ echo 'console.log( 1+1 )' > resources/js/foo.js
~/stuff/eslint-bug-report master %
❯ node_modules/.bin/eslint --fix resources/js/foo.js
/home/lydell/stuff/eslint-bug-report/resources/js/foo.js
1:20 error Delete `␍` prettier/prettier
✖ 1 problem (1 error, 0 warnings)
1 error and 0 warnings potentially fixable with the `--fix` option.
could you elaborate, please? so could it be fixed? cause I got some errors like you did
Can you copy and paste from your terminal just like I did, so I can see what you did? Maybe you did some tiny mistake that we can spot?
same errors:
Isn't that what is supposed to happen? Everything is working?
But maybe we should add linebreak-style to eslint-config-prettier, since Prettier has the end-of-line option these days.
so we have to type node_modules/.bin/eslint --fix resources/js/foo.js
instead of type eslint --fix resources/js/app.js
directly?
by the way, I'm running an issue:
do you have an idea to fix it?
so we have to type
node_modules/.bin/eslint --fix resources/js/foo.js
instead of typeeslint --fix resources/js/app.js
directly?
Yes, you have installed ESLint and all its plugins locally. When you run just eslint foo.js
on the command line, you run another ESLint that you must have installed globally at some point.
Quoting https://eslint.org/docs/user-guide/configuring:
Note: Due to the behavior of Node’s require function, a globally-installed instance of ESLint can only use globally-installed ESLint plugins, and locally-installed version can only use locally-installed plugins. Mixing local and global plugins is not supported.
This is a common mistake when using ESLint, and has nothing to do with eslint-config-prettier.
Here are a couple of ways of running the local ESLint:
node_modules/.bin/eslint foo.js
npx eslint foo.js
{ "scripts": { "eslint": "eslint" } }
to package.json and npm run eslint -- foo.js
. (Alternatively: { "scripts": { "eslint": "eslint whatever" } }
and just npm run eslint
).$PATH
and do clever stuff to itdo you have an idea to fix it?
Yes, remove the quotes
rule from your .eslintrc.js – it's not needed. Also, remove linebreak-style
and use Prettier's end-of-line
instead.
Some other tips:
okay, thank you @lydell . you are wonderful person. it works at its fullest now.
got error on my laravel-vue project
Error:
.eslintrc.json
package.json