Giovanni
Giovanni

Reputation: 595

how to set eslint rules globally?

I am new in Eslint, and I was trying to set theses rules globally, so i don't have to write them in all projects everytimes. So, in my .eslintrc.json file i wrote:

"rules": {
    
    "no-unused-vars":"warn",
    "prefer-const":"warn",
    "quotes":"off",
    "space-before-blocks":"warn",
    "space-in-parens":"warn",
    "space-before-function-paren":"warn"
    
}

How can I achieve that?

Upvotes: 0

Views: 872

Answers (1)

Quentin
Quentin

Reputation: 944205

From the manual:

The first way to use configuration files is via .eslintrc.* and package.json files. ESLint will automatically look for them in the directory of the file to be linted, and in successive parent directories all the way up to the root directory of the filesystem (/), the home directory of the current user (~/), or when root: true is specified.

So just put the file in your home directory.

Upvotes: 2

Related Questions