ant-design / ant-design-pro

👨🏻‍💻👩🏻‍💻 Use Ant Design like a Pro!
https://pro.ant.design
MIT License
36.54k stars 8.15k forks source link

使用typescript3.7.2新语法,git commit 时报错 #5608

Closed godIsAProgrammer closed 4 years ago

godIsAProgrammer commented 5 years ago

🧐 问题描述

当我使用typescript 3.7 新语法,git commit 的时候报错 使用代码如下:setSelectedRows( props.dataSource ?? [] );

错误如下: Commit failed with error 0 files committed, 1 file failed to commit: test husky > pre-commit (node v10.15.3)

    > ant-design-pro@2.3.0 lint-staged /home/caoqisen/WorkSpace/VV-MERCHANT-FRONTEND-PC
    > lint-staged

    Stashing changes... [started]
    Stashing changes... [skipped]
    → No partially staged files found...
    Running linters... [started]
    Running tasks for **/*.{js,ts,tsx,json,jsx,less} [started]
    Running tasks for **/*.{js,jsx} [started]
    Running tasks for **/*.{js,jsx} [skipped]
    → No staged files match **/*.{js,jsx}
    node ./scripts/lint-prettier.js [started]
    node ./scripts/lint-prettier.js [failed]
    →
    Running tasks for **/*.{js,ts,tsx,json,jsx,less} [failed]
    →
    Running linters... [failed]
    ✖ node ./scripts/lint-prettier.js found some errors. Please fix them and try committing again.
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! ant-design-pro@2.3.0 lint-staged: `lint-staged`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the ant-design-pro@2.3.0 lint-staged script.
    npm ERR! This is probably not a problem... (show balloon)

🚑 其他信息

ant-design-pro: 2.3.0

chenshuai2144 commented 5 years ago

看样子是 prettier 不支持你的新语法。需要等待社区适配完毕了

Yunkou commented 5 years ago

https://github.com/prettier/prettier/pull/6863

已经处理了,关注最新prettier 版本

godIsAProgrammer commented 4 years ago

感谢!