Ant-design-pro: 🧐[问题]安装后不能git commit,

Created on 19 Nov 2020  ·  3Comments  ·  Source: ant-design/ant-design-pro

问题:

我根据首页说明, 安装 antdesign pro v4 typescript,一步步成功后,不能运行 git commit 命令,错误是在'npm run lint-stage:js'上,请问我该怎么解决这个问题?

我的操作系统:

macOS Catalina
version: 10.15.7

错误过程:

执行commit 命令:

$  git commit -m "init"

报错:

 > running pre-commit hook: npm run precommit

> [email protected] precommit /Users/cola/code/antd/ant_pro_v4_ts
> lint-staged

⚠ Skipping backup because there’s no initial commit yet.

✔ Preparing...
⚠ Running tasks...
  ✔ Running tasks for **/*.less
  ❯ npm run lint-staged:js [FAILED]
    ✖ npm run lint-staged:js [FAILED]
  ✔ Running tasks for **/*.{js,jsx,tsx,ts,less,md,json}
✔ Applying modifications...

✖ npm run lint-staged:js:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] lint-staged:js: ....
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] precommit: `lint-staged`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] precommit script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/yinggu/.npm/_logs/2020-11-19T14_50_17_415Z-debug.log
🕵🏻‍♀️ question

Most helpful comment

是说 import 和 代码之间没有空行。加个空行就好了。

npm run lint --fix

All 3 comments

手动执行 npm run precommit ,看看到底是什么报错

@chenshuai2144 是这两个错误:
/Users/yinggu/code/antd/ant_pro_v4_ts/src/components/GlobalHeader/RightContent.tsx
10:1 error Expected 1 empty line after import statement not followed by another import import/newline-after-import

/Users/yinggu/code/antd/ant_pro_v4_ts/src/layouts/BasicLayout.tsx
21:1 error Expected 1 empty line after import statement not followed by another import import/newline-after-import

错误说是这两个文件在import statement之后缺少空行,我手动加了以后,再次运行npm run precommit,那加的空行自动消失了,所以又报同样的错了。

我现在应该用什么命令修复呢?

是说 import 和 代码之间没有空行。加个空行就好了。

npm run lint --fix
Was this page helpful?
0 / 5 - 0 ratings

Related issues

2uncle-code picture 2uncle-code  ·  3Comments

cheung1111 picture cheung1111  ·  3Comments

yaoleiroyal picture yaoleiroyal  ·  3Comments

kaoding picture kaoding  ·  3Comments

ghost picture ghost  ·  3Comments