Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支持通过参数启用 lint 检查 #44

Closed
alexmaze opened this issue Dec 20, 2017 · 12 comments · Fixed by #46
Closed

支持通过参数启用 lint 检查 #44

alexmaze opened this issue Dec 20, 2017 · 12 comments · Fixed by #46

Comments

@alexmaze
Copy link
Contributor

目前静态检查的错误不会出现在编译结果中,特别是 typescript 项目,希望能够支持每次 compile 时预先 lint 一边源码。

@nighca
Copy link
Collaborator

nighca commented Dec 22, 2017

@yanhao1991 这个是为了性能特地这么做的,ts 项目规模稍微大一点编译性能会很差,考虑到开发时的补全类型提示编辑器即可支持,而检查类型信息以及 tslint 的行为可以通过额外的 script 去做,所以把 ts
的类型检查从编译行为里去掉了。

这个我加个配置项控制吧,默认不加进来,可以通过配置加进来

@doxiaodong
Copy link
Contributor

这个不是 travis.ci 做么, 本地要做的话可以加入 husky

@nighca
Copy link
Collaborator

nighca commented Dec 22, 2017

@doxiaodong 也确实可能有开发编译时就把 ts 的类型错误报出来的需求。

husky 是啥?

@alexmaze
Copy link
Contributor Author

@nighca coooool

@doxiaodong
Copy link
Contributor

@nighca 就是 git hooks, 比如设置 prepush script 就可以在 git push 操作前执行相应操作

@doxiaodong
Copy link
Contributor

在开发的时候用 tslint 插件来协助检查,在 travis 的时候是为了防止没有检查的小伙伴。 使用 husky 是为了照顾到不常看 travis 检查结果的人

@nighca
Copy link
Collaborator

nighca commented Dec 22, 2017

@doxiaodong 嗯我觉得这也是个比开发时做类型检查更好的时机

@doxiaodong
Copy link
Contributor

还是尽量在安装 tslint, eslint 插件吧,这样可以养成好的编码习惯。

@alexmaze
Copy link
Contributor Author

@doxiaodong 插件都是有的,vscode上tslint插件的问题是只会报出当前编辑文件的错误信息,如果改了接口导致其他文件出了问题就看不到了

@doxiaodong
Copy link
Contributor

@yanhao1991 你这个情况只能加在 serve 上,这样你才能很快发现,因为如果加在 generate 上的话,改完代码后到提交你也不一定会跑 generate。
但是如果加在 serve 上面的话,lint es,ts,css 都会有性能问题。我觉得实在需要的话使用 husky prepush 钩子吧。https://github.com/typicode/husky

@nighca
Copy link
Collaborator

nighca commented Dec 26, 2017

@doxiaodong 景豪的需求应该就是加在 serve 里(对实现来说就是 dev 的环境下),不过不是做 lint 只是把我先前加上的 transpileOnly 干掉,就是 ts 的类型检查,这种情况确实容易有性能问题,不过相比再做 lint 什么的好一点。

我觉得可以放开来配置

@doxiaodong
Copy link
Contributor

我知道了,这个本身对性能影响应该是在可接受范围了,你直接删除都可以。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants