首页 > TAG信息列表 > staged

使用husky、lint-staged、prettier来规范代码

新来了两个前端同事,大家的代码风格都不太一样,增加了review的难度,听朋友说他们在用prettier,查了点资料试了下:   添加依赖 yarn add --dev husky prettier --registry https://registry.npm.taobao.org --ignore-engines   编辑package.json,添加脚本 npm set-script "pre-commi

代码规范之 lint-staged

代码规范之 lint-staged 在代码提交之前,进行代码规则检查能够确保进入git库的代码都是符合代码规则的。但是整个项目上运行lint速度会很慢,lint-staged能够让lint只检测暂存区的文件,所以速度很快。 安装与配置 安装husky和lint-staged: yarn add husky lint-staged --dev package

git restore指令和git restore --staged 的使用

  一:git restore指令(1)先用git status看一下状态 (2)打开a.c添加点内容(原本内容是aaa) (3)再用git status看一下状态 此时a.c的状态是刚刚更改过,但是还没有用git add指令添加到暂存区中,也就是说a.c目前处于工作区下。 (4)使用git restore也就是:git restore a.c (5)用git status

git commit -m 时报错:ant-design-pro@1.0.0 lint-staged: `lint-staged`

如题 ant-design-pro@1.0.0 lint-staged: `lint-staged` 解决方法: 找到webpack.json 或者 package.json 每个项目配置文件名不一样,可以尝试通过全项目搜索 npm run lint-staged 找到并且移除 "husky": { "hooks": { "pre-commit": "npm run lint-staged"

github 原理图

local staged github stage and commit push local staged github

Git 状态 untracked 和 not staged的区别

untrack表示是新文件,没有被add过,是为跟踪的意思。 not staged 表示add过的文件,即跟踪文件,再次修改没有add,就是没有暂存的意思 具体看: https://git-scm.com/book/zh/v2/Git-%E5%9F%BA%E7%A1%80-%E8%AE%B0%E5%BD%95%E6%AF%8F%E6%AC%A1%E6%9B%B4%E6%96%B0%E5%88%B0%E4%BB%93%E5%BA%93

gitignore文件不生效

在git中如果想忽略掉某个文件,不让这个文件提交到版本库中,可以使用修改根目录中 .gitignore 文件的方法(如果没有这个文件,则需自己手工建立此文件)。这个文件每一行保存了一个匹配的规则例如: # 此为注释 – 将被 Git 忽略 *.sample    # 忽略所有 .sample 结尾的文件 !lib.sa

litemall源码阅读2.04管理后台前端litemall-admin之husky与lint

在package.json中有如下两个对象: "husky": { "hooks": { "pre-commit": "lint-staged" }},"lint-staged": { "src/**/*.{js,vue}": [ "eslint --fix", "git add" ]} 同时在devDependencie

2020最新编辑器集成eslint、prettier、stylelint,git提交预检查代码配置

webstorm 编辑器自动格式化配置: plugin webstorm设置搜eslintr、eslint、stylelint,如果没有,搜plugin,安装prettier、eslint、stylelint File watchs 设置里搜File watchs,增加prettier,打钩开启自动格式化,则会在保存时自动格式化。   VS code 安装 "ESLint" 以及 "Prettier -

AngularJS项目git提交失败"node --max-old-space-size=10240"

> lint-staged   '"node --max-old-space-size=10240"' �����ڲ����ⲿ���Ҳ���ǿ����еij��� ���������ļ��� npm ERR! code ELIFECYCLE npm ERR! errno 9009 npm ERR! foshan-sp-manage@0.0.0 lint-staged: `lint-staged` npm ERR! Exit status 9009 npm ER

代码风格工具整理

1.lint-stage+husky npm install --save-dev lint-staged husky 配置:可在.huskyrc.js  或者package.json https://www.npmjs.com/package/husky "husky": { "hooks": { "pre-commit": "lint-staged" } }, "lint

vue项目在git commit时,使用eslint检测

 用vue-cli3创建新项目可以自定义配置,选择eslint,所以eslint不需要配置, 项目根目录下面生成一个 .eslintrc.js文件,里面可以自定义配置eslint规则   现在在开发的时候,只要不符合esLint的规范就会报错,编译不了,现在我们先让它还是报错,但是能够编译,报错只在命令行看到就可以了,需要

git整理

https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/0013760174128707b935b0be6fc4fc6ace66c4f15618f8d000/             配置git身份信息: git config --global user.name "quzq" git config --global user.email "quzq@qq.co