Skip to content

Commit 941c263

Browse files
committed
feat: upgrade to zhlint v0.7.1
1 parent d4bd442 commit 941c263

File tree

6 files changed

+5445
-869
lines changed

6 files changed

+5445
-869
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# <img src="https://raw.githubusercontent.com/Jinjiang/zhlint/master/logo.svg" style="vertical-align: middle;"> eslint-plugin-zhlint
1+
# <img src="https://raw.githubusercontent.com/Jinjiang/zhlint/master/docs/logo.svg" style="vertical-align: middle;"> eslint-plugin-zhlint
22

33
Linting Chinese typographies in JavaScript/TypeScript with [zhlint](https://github.com/Jinjiang/zhlint).
44

@@ -49,7 +49,10 @@ or with options:
4949
"lintComments": true,
5050
"lintStringLiterals": true,
5151
"zhlint": {
52-
"rules": ["space-full-width-content", "space-punctuation"]
52+
"rules": {
53+
"fullWidthPunctuation": ",。:;?!“”‘’()",
54+
"unifiedPunctuation": "traditional"
55+
}
5356
}
5457
}
5558
]

lib/rules/zhlint.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ function tryRunZhlint(
2424
},
2525
messageId: "zhlint",
2626
data: {
27-
zhlintRuleName: validation.name,
2827
zhlintMsg: validation.message,
2928
},
3029
fix(fixer) {
@@ -65,15 +64,23 @@ module.exports = {
6564
},
6665
],
6766
messages: {
68-
zhlint: "[zhlint/{{ zhlintRuleName }}] {{ zhlintMsg }}",
67+
zhlint: "[zhlint] {{ zhlintMsg }}",
6968
},
7069
},
7170
create(context) {
7271
const sourceCode = context.getSourceCode();
73-
const { zhlint: zhlintOptions, ...ruleOptions } = {
72+
let { zhlint: zhlintOptions, ...ruleOptions } = {
7473
lintComments: true,
7574
lintStringLiterals: true,
7675
...context.options[0],
76+
zhlint: {
77+
rules: {
78+
preset: "default",
79+
trimSpace: false, // disabled by default because of false positives
80+
...context.options[0]?.zhlint?.rules,
81+
},
82+
...context.options[0]?.zhlint,
83+
},
7784
};
7885
return {
7986
Program() {

0 commit comments

Comments
 (0)