File tree Expand file tree Collapse file tree 9 files changed +17
-7
lines changed
Expand file tree Collapse file tree 9 files changed +17
-7
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " client" ,
33 "displayName" : " React-Intl-Linter - Client" ,
4- "version" : " 0.0.2 " ,
4+ "version" : " 0.0.3 " ,
55 "description" : " vscode linter extension for react-intl" ,
66 "repository" : " git@github.com:Styx11/react-intl-linter.git" ,
77 "author" : " styx11 <1654630248@qq.com>" ,
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ const getIntlIdCount = (number: number): string =>
3737 */
3838export const getCleanIntlId = ( translationResult : string ) : string =>
3939{
40- return translationResult . replace ( INVALID_INTL_ID_CHARACTER , '' )
40+ return translationResult . replace ( INVALID_INTL_ID_CHARACTER , '' ) . trim ( )
4141}
4242
4343/**
Original file line number Diff line number Diff line change 1414 " src"
1515 ],
1616 "exclude" : [
17- " node_modules"
17+ " node_modules" ,
18+ " package-lock.json" ,
19+ " package.json"
1820 ]
1921}
Original file line number Diff line number Diff line change 11{
22 "name" : " react-intl-linter" ,
3- "version" : " 0.0.2 " ,
3+ "version" : " 0.0.3 " ,
44 "publisher" : " styx11" ,
55 "description" : " vscode linter extension for react-intl" ,
66 "repository" : " git@github.com:Styx11/react-intl-linter.git" ,
Original file line number Diff line number Diff line change 11{
22 "name" : " server" ,
3- "version" : " 0.0.2 " ,
3+ "version" : " 0.0.3 " ,
44 "description" : " vscode linter extension for react-intl" ,
55 "repository" : " git@github.com:Styx11/react-intl-linter.git" ,
66 "author" : " styx11 <1654630248@qq.com>" ,
Original file line number Diff line number Diff line change 11
22// 匹配单引号/双引号内的字符串文本
3- export const StringReg = / ' ( .+ ) ' | " ( .+ ) " / gu
3+ // 单个字符 . 的匹配默认是贪婪的,所以当有多个带引号的句子在一行时,匹配结果就会是从第一个引号开始到最后一个引号结束,所以要用 [^'\n]+ 和 [^"\n]+ 去匹配
4+ // 例如 const message = `${'添加'}hellllllo${'添加'}` 会匹配为 添加'}hellllllo${'添加
5+ export const StringReg = / ' ( [ ^ ' \n ] + ) ' | " ( [ ^ " \n ] + ) " / gu
46
57// 错误信息
68export const DiagnosticMessage = ' is a Chinese sentence'
Original file line number Diff line number Diff line change 88
99'添加'
1010
11+ const message = `${ "添加" } hellllllo${ "添加" } `
12+
13+ const testMsg = `${ '添加' } hellllllo${ '一个文本' } hellllllo{"这是另一个文本"}`
14+
1115"English!!!"
Original file line number Diff line number Diff line change 1313 " src"
1414 ],
1515 "exclude" : [
16- " node_modules"
16+ " node_modules" ,
17+ " package-lock.json" ,
18+ " package.json"
1719 ],
1820 "references" : [
1921 { "path" : " ./client" },
You can’t perform that action at this time.
0 commit comments