eslint and prettier conflict on singleQuote - eslint

Both eslint and prettier config singleQuote.
Eslint prefer escape version
While prettier prefer double version

Related

What is the difference between running npx eslint and npx?

I am using npm 8.5.0 and node v16.14.2 on a big project. When I run eslint, I can choose to run it without npx, or I can run it with npx. There doesn't seem to be any difference. I'm writing some npm scripts that run eslint and I don't know whether to write npx eslint or eslint.
What is the difference between running npx eslint and eslint?
npx will download and run the package and is meant for interactive use where you just want to use a tool from the npm registry.
You shouldn't use it in your package.json's scripts section; instead just make sure the desired version of eslint is in your package's dev dependencies and use "eslint" in the scripts, so you're certain to use the correct version.

How to Globally Install ESLint with TypeScript-Support?

I would like to configure my GLOBAL eslint installation to lint my typescript project in Visual Studio Code.
So I installed the Visual Studio Code extension "ESLint" and installed ESLint with
npm install -g eslint
According to https://www.npmjs.com/package/#typescript-eslint/eslint-plugin it is required to install #typescript-eslint/eslint-plugin globally as well, so I ran
npm install -g #typescript-eslint/parser #typescript-eslint/eslint-plugin
to install it together with the ts parse #typescript-eslint/parser.
Next, I added a very simple .eslintrc-file:
{
"parser": "#typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": { }
}
However, as soon as I run eslint . in my project directoy I get:
Error: Failed to load parser '#typescript-eslint/parser' declared in '.eslintrc.js': Cannot find module '#typescript-eslint/parser'
Next I tried removing the globally installed parser and install it locally, yet this won't work neither: Now my global eslint installation can find my local parser, but the parser needs yet another local installation of typescript, eslint etc. I want to run everything globally, though.
I simply can't get it to work! Can anyone help me with the process?
Here are some suggestions...
In your .eslintrc you haven't specified the '#typescript-eslint' plugin...
"plugins": ["#typescript-eslint"],
Also, if you get this working you will also want to specify parserOptions.project & tsconfigRootDir with an absolute path because finding your tsconfig.json - so that you can use the rules that require type info - is harder from a global install.
Also, I think you need to explicitly tell the eslint plugin to validate your TS files (and maybe js and react etc., as desired) with vsc settings....
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],
BUT, I fear the whole thing is an uncertain undertaking.... note that the docs say...
It is also possible to install ESLint globally rather than locally
(using npm install eslint --global). However, this is not recommended,
and any plugins or shareable configs that you use must be installed
locally in either case.
I'm noting here that global installs are not recommended, but also that this quote seems to contradict the reference you noted that said to install the plugin globally. I'm not sure which is right as I've stopped setting it up this way since it isn't recommended. Hope this helps never-the-less.

vim w0ro/ale tslint doesnt work

I've benn using w0rp/ale for linting with eslint.
I've switched to tslint and the linting stopped working. I have the tslint npm package installed and have tslint.json confing file. Is there something I need to do or should check?
Thank you very much.

eslint missing under \node_modules\.bin

I have globaly installed eslint using npm : npm install -g eslint, then I setup a configuration file eslint --init by answering the questions as follow :
? How would you like to configure ESLint? Use a popular style guide
? Which style guide do you want to follow? Airbnb
? Do you use React? No
? What format do you want your config file to be in? JavaScript
I tried to run eslint on my app.js file eslint app.jsIt doesn't work
I tried to run it doing so : node_modules\.bin\eslint app.js but Ican't eslint file under \node_modules.bin
NPM Version 5.6.0
Node Version 8.10.0
Seeing the error you have just mentioned after trying:
eslint --debug app.js
You need to globally install the eslint plugin import and the eslint airbnb config plugin.
npm -g install eslint-plugin-import eslint-config-airbnb-base
You need to install said plugin because in the eslint --init configuration you have selected the Airbnb style guide.

Eslint version automatically downgrading on init

I'm installing ESLint on a project with the following command:
npm install --save-dev eslint#latest
which gets me the 4.1.1 version of the package.
After i init it with the command:
./node_modules/.bin/eslint --init
I follow the instructions to use Airbnb codestyle and i get downgraded to version 3.19.0.
How can i get it to use version 4.0.0 atleast?
Working as intended.
Quoting #kaicataldo on github:
"A number of breaking changes were introduced on the plugin authoring side of things in ESLint v4. Installing ESLint v4 with a plugin that has not been updated yet could result in a broken installation, so the behavior you're seeing is intentional to ensure that everything works together."

Resources