简体   繁体   English

使用npm全局安装jshint-配置文件位置

[英]install jshint globally with npm - config file location

i've installed jshint using npm install -g jshint and i want to know where is the .jshintrc file is located - the default location for that file. 我已经使用npm install -g jshint ,我想知道.jshintrc文件在哪里-该文件的默认位置。

I have go through the docs: http://jshint.com/docs/ and i saw the paragraph about where it search for that file. 我浏览了以下文档: http : //jshint.com/docs/ ,我看到了有关在哪里搜索该文件的段落。 but runnig find . -name .jshintrc 但是runnig find . -name .jshintrc find . -name .jshintrc in my home directory only find rc files that are in node_modules directories, so i don't understand where jshint get his configuration from. 我的主目录中的find . -name .jshintrc仅找到node_modules目录中的rc文件,因此我不明白jshint从哪里获取他的配置的。

I also searched the /usr/lib/node_modules/jshint - this is where the jshint is installed globally and no luck there , can anyone point me to that information?? 我还搜索了/usr/lib/node_modules/jshint这是jshint全局安装的地方,没有运气,有人可以指出我该信息吗?

As far as I know no file is added by installing jshint (example linked below). 据我所知,没有通过安装jshint添加文件(示例链接如下)。 Normally, you would put the “.jshintrc” in the source code root for the project. 通常,您将“ .jshintrc”放在项目的源代码根目录中。 This way it's easily discoverable by others. 这样,其他人很容易发现它。 Then each project applies it's own set of rules. 然后,每个项目都会应用自己的一组规则。 These kind of files typically applies recursively in the folders below. 这些类型的文件通常递归地应用于以下文件夹中。

But they can be put deeper in folder structure as well. 但是它们也可以放在文件夹结构中。 This could be useful in cases where backend and clients use different rules, or when backend is written in another programming language. 如果后端和客户端使用不同的规则,或者后端是用另一种编程语言编写的,这可能会很有用。

Here is an example of such a file: https://github.com/jshint/jshint/blob/master/examples/.jshintrc 这是此类文件的示例: https : //github.com/jshint/jshint/blob/master/examples/.jshintrc

Best of luck. 祝你好运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM