如何在打字稿eslint中强制执行文件名和文件夹名称约定? [英] How can I enforce filename and folder name convention in typescript 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 doesn't implement by default the file name check, see this github issue from 2015.
某些插件确实喜欢 eslint-plugin-unicorn 或 eslint-plugin-filenames .
Because Tslint is now deprecated, they created the project typescript-eslint, which is handling file naming casing, you could check it out :)
这篇关于如何在打字稿eslint中强制执行文件名和文件夹名称约定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!