I use atom text editor. Here are the steps I took to get my linter working with React and ES6:
npm install --save eslint
eslint --init
, which helps create the file with a series of questions that I answer on the command line)I don't want to have to create the .eslintrc everytime I start coding a new project. I want to use the global .eslintrc file, which I found when I:
How can I make it so that when I fire up a new file and start coding I already get the options defined in this global file?
In particular, this is the setup I am using in individual projects:
{
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"sourceType": "module"
},
"env": {
"es6": true
},
"plugins": [
"eslint-plugin-react"
]
}
And I want this to be the default.
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.
Go to settings --> packages --> linter-eslint settings. On that menu, look for the .eslintrc Path
option. For your particular preference, you would put ~/.atom/packages/linter/.eslintrc
in that field. Your .eslintrc
is now being used globally across all of your projects.
You could use the configuration cascading to your advantage : http://eslint.org/docs/user-guide/configuring#configuration-cascading-and-hierarchy
workspace
|
|_ .eslintrc (global, root = true)
|
|_ project-1
|
|_ .eslintrc (project specific, if you need to overwrite some rules)
From the eslint documentation:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With