我eslint用于typescript约定。我检查了这个https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md只适用于代码的规则。
我正在寻找一个规则,它可以将camelCase文件名强制为snake_case. 如何在打字稿中设置此规则?
Gré*_*EUT 14
Eslint 默认情况下不实现文件名检查,请参阅2015 年的 github 问题。
有些插件确实像eslint-plugin-unicorn或eslint-plugin-filenames。
由于 Tslint 现已弃用,因此他们创建了项目typescript-eslint,该项目负责处理文件命名大小写,您可以查看一下:)
小智 11
eslint 插件eslint-plugin-check-file允许您对文件名和文件夹强制执行一致的命名模式。
将camelCase样式应用于文件名:
{
"rules":{
"check-file/filename-naming-convention":[
"error",
{
"*.{js,ts}":"CAMEL_CASE"
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
将snake_case样式应用到文件夹名称:
{
"rules":{
"check-file/folder-naming-convention":[
"error",
{
"src/**/":"SNAKE_CASE"
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
查看此链接以获取有关 的更多信息eslint-plugin-check-file。
| 归档时间: |
|
| 查看次数: |
3039 次 |
| 最近记录: |