admin管理员组文章数量:1293316
I use atom text editor. Here are the steps I took to get my linter working with React and ES6:
- install atom-react package
- when I start a new project, I run
npm install --save eslint
- create an .eslintrc file in my project folder (this can be done either manually or running mand
eslint --init
, which helps create the file with a series of questions that I answer on the mand 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:
- Go to Atom > Preferences
- Click on Open Config Folder
- Click on .atom > packages > linter > .eslintrc
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.
I use atom text editor. Here are the steps I took to get my linter working with React and ES6:
- install atom-react package
- when I start a new project, I run
npm install --save eslint
- create an .eslintrc file in my project folder (this can be done either manually or running mand
eslint --init
, which helps create the file with a series of questions that I answer on the mand 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:
- Go to Atom > Preferences
- Click on Open Config Folder
- Click on .atom > packages > linter > .eslintrc
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.
Share edited Sep 1, 2016 at 19:29 xoux asked Sep 1, 2016 at 15:08 xouxxoux 3,4943 gold badges31 silver badges59 bronze badges2 Answers
Reset to default 4Go 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/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:
本文标签: javascriptHow do I get my projects to use a global eslintrc file by defaultStack Overflow
版权声明:本文标题:javascript - How do I get my projects to use a global .eslintrc file by default? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741577568a2386376.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论