@lsby/eslint-plugin 0.0.11 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,16 +13,20 @@ module.exports = {
13
13
  create(context) {
14
14
  return {
15
15
  VariableDeclaration(node) {
16
- // 检查变量声明的类型(排除 declare)
16
+ // 跳过 unique symbol
17
17
  if ((node.kind === 'const' || node.kind === 'var') && !node.declare) {
18
+ let hasUniqueSymbol = node.declarations.some((decl) => {
19
+ const typeAnn = decl.id.typeAnnotation?.typeAnnotation
20
+ return typeAnn?.type === 'TSTypeOperator' && typeAnn.operator === 'unique'
21
+ })
22
+ if (hasUniqueSymbol) return
23
+
18
24
  // 使用修复功能将 const 或 var 替换为 let
19
25
  context.report({
20
26
  node,
21
27
  message: '使用let代替const或var',
22
28
  fix(fixer) {
23
- // 获取变量声明的范围
24
29
  const range = node.range
25
- // 确保给定的 range 是有效的
26
30
  return fixer.replaceTextRange([range[0], range[0] + node.kind.length], 'let')
27
31
  },
28
32
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lsby/eslint-plugin",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "pub:public": "bumpp && npm publish --access public",