Skip to content

Commit

Permalink
Merge pull request #121 from liuyib/next
Browse files Browse the repository at this point in the history
  • Loading branch information
Jinjiang authored Oct 24, 2023
2 parents 52ebdda + 96c66ed commit a447925
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/rules/case-zh-units.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ const generateHandler = (options: Options): Handler => {
if (token.type === CharType.LETTERS_HALF && token.content.match(/^\d+$/)) {
// make sure the content after is a Chinese unit
const tokenAfter = findNonCodeVisibleTokenAfter(group, token)

if (Array.isArray(tokenAfter)) return
if (tokenAfter && tokenAfter.content.match(unitMatcher)) {
// make sure there is no space between originally
const { spaceHost: spaceHostAfter, tokens: tokenSeqAfter } =
Expand Down
4 changes: 4 additions & 0 deletions test/rules.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,10 @@ describe('lint by cases', () => {
expect(getOutput('2019年06月26号 2019-06-26 12:00', options)).toBe(
'2019年06月26号 2019-06-26 12:00'
)
expect(getOutput('1《测试》2【测试】3「测试」4(测试)', options)).toBe(
'1《测试》2【测试】3 “测试” 4 (测试)'
)
expect(getOutput('1?2!', options)).toBe('1?2!')
})
test('[case-abbrs]', () => {
expect(getOutput('运行时 + 编译器 vs. 只包含运行时', options)).toBe(
Expand Down

0 comments on commit a447925

Please sign in to comment.