如何在打字稿eslint中强制执行文件名和文件夹名称约定? [英] How can I enforce filename and folder name convention in typescript eslint?

查看:118
本文介绍了如何在打字稿eslint中强制执行文件名和文件夹名称约定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将 eslint 用于 typescript 约定.然后我检查了此规则 https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md 这仅适用用于代码.

I am using eslint for typescript convention. And I checked this rule https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md which only works for code.

我正在寻找一个规则,该规则可以将文件名强制为 camelCase ,将文件夹名称强制为 snake_case .如何在打字稿中设置此规则?

I am looking for a rule which can enforce filename to be camelCase and folder name to be snake_case. How can I set this rule in typescript?

推荐答案

Eslint默认情况下不实现文件名检查,请参见

Eslint doesn't implement by default the file name check, see this github issue from 2015.

某些插件确实喜欢 eslint-plugin-unicorn eslint-plugin-filenames .

由于Tslint现在已被弃用,因此他们创建了项目

Because Tslint is now deprecated, they created the project typescript-eslint, which is handling file naming casing, you could check it out :)

这篇关于如何在打字稿eslint中强制执行文件名和文件夹名称约定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆