简体   繁体   English

在JavaScript Webapp中将节点与eslint一起使用

[英]Use of node with eslint in a javascript webapp

I have a javascript application with eslint set-up and the needed Node modules, all in the same project folder. 我有一个eslint设置和所需的Node模块的javascript应用程序,它们都在同一项目文件夹中。 Node is only used so that eslint works. 仅使用Node以便eslint工作。

The whole thing is pushed to GitHub and I'm noticing now the whole node-modules is getting uploaded with it (17mb approx), again I'm just using node for eslint only. 整个过程都推送到了GitHub,我注意到现在整个节点模块都随它一起上传(大约17mb),我再次仅将node用于eslint。

I feel like I'm doing something wrong and that I have set-up my project incorrectly. 我觉得我做错了事,并且我的项目设置不正确。 Should I be using .ignore here in git or something else, or I'm I overthinking this. 我应该在git或其他东西中使用.ignore,还是我对此太想了。

Thanks 谢谢

Create a .gitignore file at the root of your project. 在项目的根目录下创建一个.gitignore文件。 Add node_modules to it. node_modules添加node_modules Remove the node_modules folder from your local repo. 从本地存储库中删除node_modules文件夹。 Recommit the changes. 重新提交更改。 Then push up again. 然后再次向上推。

Then run npm i on your terminal/command line to get the eslint packages back on your local computer. 然后在您的终端/命令行上运行npm i ,以将eslint软件包恢复到本地计算机上。 Now the directory will no longer be pushed on future commits. 现在,该目录将不再在以后的提交中推送。

You should use .gitignore for pushing redundant file to your repo here 您应该使用.gitignore将冗余文件推送到您的仓库中

https://git-scm.com/docs/gitignore https://git-scm.com/docs/gitignore

Here is the sample .gitignore file for Node from github 这是来自github的Node的示例.gitignore文件

https://github.com/github/gitignore/blob/master/Node.gitignore https://github.com/github/gitignore/blob/master/Node.gitignore

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

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