eslint-plugin-light 1.0.21 → 1.0.22

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## <small>1.0.22 (2026-03-24)</small>
2
+
3
+ * feat: add no-complex-style-class rule ([2cc25ee](https://github.com/novlan1/plugin-light/commits/2cc25ee))
4
+ * feat: optmize eslint rules ([b3e85c6](https://github.com/novlan1/plugin-light/commits/b3e85c6))
5
+ * chore: update deps ([6828b0c](https://github.com/novlan1/plugin-light/commits/6828b0c))
6
+ * chore: update package.json ([338b104](https://github.com/novlan1/plugin-light/commits/338b104))
7
+
8
+
9
+
1
10
  ## <small>1.0.21 (2026-01-04)</small>
2
11
 
3
12
  * feat(eslint-plugin-light): add no-src-imports-in-components rule ([b960951](https://github.com/novlan1/plugin-light/commits/b960951))
package/README.md CHANGED
@@ -801,6 +801,75 @@ bannedPrefixes: ['src', '@/', '~/']
801
801
  message: '该目录将被发布为独立的 npm 包,请使用相对路径导入'
802
802
  ```
803
803
 
804
+ ### 4.19. no-complex-style-class
805
+
806
+ 禁止在 Vue 模板的 `:style` 或 `:class` 绑定中**直接**使用函数调用、模板字符串等复杂表达式。
807
+
808
+ 背景:
809
+
810
+ > uni-app Vue2 小程序中,`:style` 和 `:class` 的**顶层表达式**不支持函数调用和模板字符串等语法。例如 `:style="tool._style(xxx)"` 或 `:class="\`${prefix}-item\`"` 在小程序中会解析失败。
811
+ >
812
+ > 应使用计算属性或字符串拼接 `'' + xxx` 代替。
813
+ >
814
+ > 注意:在数组元素、对象属性值、条件表达式分支中使用函数调用是**允许**的,例如 `:class="[getClass(), 'base']"` 和 `:style="flag ? getStyle() : ''"` 在小程序中可以正常工作。
815
+
816
+ Usage:
817
+
818
+ ```js
819
+ // .eslintrc.js
820
+
821
+ module.exports = {
822
+ plugins: [
823
+ 'light',
824
+ ],
825
+ rules: {
826
+ 'light/no-complex-style-class': 2,
827
+ },
828
+ }
829
+ ```
830
+
831
+ 错误示例:
832
+
833
+ ```html
834
+ <!-- ❌ 顶层函数调用 -->
835
+ <div :style="tool._style(xxx)" />
836
+ <div :class="getClass(item)" />
837
+
838
+ <!-- ❌ 顶层模板字符串 -->
839
+ <div :style="`color: ${color}`" />
840
+ <div :class="`${prefix}-item`" />
841
+ ```
842
+
843
+ 正确示例:
844
+
845
+ ```html
846
+ <!-- ✅ 变量引用 -->
847
+ <div :style="myStyle" />
848
+ <div :class="item.className" />
849
+
850
+ <!-- ✅ 对象表达式(值为变量) -->
851
+ <div :style="{ color: myColor }" />
852
+ <div :class="{ active: isActive }" />
853
+
854
+ <!-- ✅ 字面量数组 -->
855
+ <div :class="['a', 'b']" />
856
+
857
+ <!-- ✅ 条件表达式(值为变量) -->
858
+ <div :style="flag ? styleA : styleB" />
859
+
860
+ <!-- ✅ 数组元素中的函数调用 -->
861
+ <div :class="[utils.getClass(classPrefix, 'medium'), tClassImage]" />
862
+
863
+ <!-- ✅ 条件表达式分支中的函数调用 -->
864
+ <div :style="inChat ? imageStyle(item) : ''" />
865
+
866
+ <!-- ✅ 数组 + 条件混合 -->
867
+ <div :class="[classPrefix, inChat ? classPrefix + '--chatting' : '', getFileTypeClass(inChat, files)]" />
868
+
869
+ <!-- ✅ 对象属性值中的函数调用 -->
870
+ <div :style="{ color: getColor() }" />
871
+ ```
872
+
804
873
  ## 5. 更新日志
805
874
 
806
875
  [点此查看](./CHANGELOG.md)
@@ -2,6 +2,7 @@ module.exports = {
2
2
  extends: require.resolve('./base'),
3
3
  rules: {
4
4
  'light/no-complex-key': 1,
5
+ 'light/no-complex-style-class': 1,
5
6
  'light/no-import-vant': 2,
6
7
  },
7
8
  };
@@ -1,4 +1,4 @@
1
- const utils = require('eslint-plugin-vue/lib/utils');
1
+ const { getParserServices } = require('../utils/parser-services');
2
2
 
3
3
 
4
4
  const DEFAULT_THRESHOLD = 3;
@@ -26,16 +26,20 @@ module.exports = {
26
26
  ], // 无配置选项
27
27
  },
28
28
  create(context) {
29
- return utils.defineTemplateBodyVisitor(context, {
29
+ const sourceCode = context.sourceCode || context.getSourceCode();
30
+
31
+ const parserServices = getParserServices(context);
32
+ if (!parserServices?.defineTemplateBodyVisitor) {
33
+ return {};
34
+ }
35
+
36
+ return parserServices.defineTemplateBodyVisitor({
30
37
  'VAttribute[key.name=\'class\']'(node) {
31
38
  if (!node.value || node.value.type !== 'VLiteral') return;
32
39
 
33
40
  const options = context.options[0] || {};
34
41
  const threshold = options.spelling || DEFAULT_THRESHOLD;
35
42
 
36
-
37
- const sourceCode = context.getSourceCode();
38
-
39
43
  const text = sourceCode.getText(node.value);
40
44
  const classValue = node.value.value.trim();
41
45
 
@@ -56,7 +60,6 @@ module.exports = {
56
60
  loc: node.value.loc,
57
61
  message: 'CSS classes should be one per line',
58
62
  fix(fixer) {
59
- const sourceCode = context.getSourceCode();
60
63
  const [startQuote, endQuote] = getQuoteChars(sourceCode, node.value);
61
64
 
62
65
  const indentation = ' '.repeat(node.loc.start.column);
@@ -1,4 +1,4 @@
1
- const utils = require('eslint-plugin-vue/lib/utils');
1
+ const { getParserServices } = require('../utils/parser-services');
2
2
 
3
3
  module.exports = {
4
4
  meta: {
@@ -12,7 +12,14 @@ module.exports = {
12
12
  schema: [],
13
13
  },
14
14
  create(context) {
15
- return utils.defineTemplateBodyVisitor(context, {
15
+ const sourceCode = context.sourceCode || context.getSourceCode();
16
+
17
+ const parserServices = getParserServices(context);
18
+ if (!parserServices?.defineTemplateBodyVisitor) {
19
+ return {};
20
+ }
21
+
22
+ return parserServices.defineTemplateBodyVisitor({
16
23
  'VElement[name=\'img\']'(node) {
17
24
  const srcBinding = node.startTag.attributes.find(attr => attr.directive
18
25
  && attr.key.name
@@ -30,10 +37,10 @@ module.exports = {
30
37
  message: 'Use v-lazy instead of :src for image loading',
31
38
  fix(fixer) {
32
39
  // 获取 :src 绑定的完整表达式文本
33
- const srcText = context.getSourceCode().getText(srcBinding.value.expression);
40
+ const srcText = sourceCode.getText(srcBinding.value.expression);
34
41
 
35
42
  // 获取 :src 属性的完整文本
36
- const fullSrcText = context.getSourceCode().getText(srcBinding);
43
+ const fullSrcText = sourceCode.getText(srcBinding);
37
44
 
38
45
  // 计算替换文本
39
46
  let replacement;
@@ -10,6 +10,9 @@ module.exports = {
10
10
  description: desc,
11
11
  category: 'Best Practices',
12
12
  },
13
+ messages: {
14
+ requireTryCatch: desc,
15
+ },
13
16
  },
14
17
  schema: [{
15
18
  type: 'object',
@@ -32,12 +35,12 @@ module.exports = {
32
35
  const calleePropertyName = node.callee?.property?.name;
33
36
 
34
37
  const subNode = node.arguments?.[0];
35
- const sbCalleeObjectName = subNode?.callee?.object?.name;
38
+ const subCalleeObjectName = subNode?.callee?.object?.name;
36
39
  const subCalleePropertyName = subNode?.callee?.property?.name;
37
40
 
38
41
  if (calleeObjectName === 'JSON'
39
42
  && calleePropertyName === 'parse'
40
- && (strict || !(sbCalleeObjectName === 'JSON' && subCalleePropertyName === 'stringify'))
43
+ && (strict || !(subCalleeObjectName === 'JSON' && subCalleePropertyName === 'stringify'))
41
44
  ) {
42
45
  let p = node.parent;
43
46
  let hasTryFlg = false;
@@ -48,7 +51,10 @@ module.exports = {
48
51
  }
49
52
 
50
53
  if (!hasTryFlg) {
51
- context.report(node, desc);
54
+ context.report({
55
+ node,
56
+ messageId: 'requireTryCatch',
57
+ });
52
58
  }
53
59
  }
54
60
  },
@@ -1,3 +1,5 @@
1
+ const { getParserServices } = require('../utils/parser-services');
2
+
1
3
  module.exports = {
2
4
  meta: {
3
5
  type: 'problem',
@@ -14,16 +16,17 @@ module.exports = {
14
16
  },
15
17
 
16
18
  create(context) {
17
- const fileName = context.getFilename();
19
+ const fileName = context.filename || context.getFilename();
18
20
  if (!fileName.endsWith('.vue')) {
19
21
  return {};
20
22
  }
21
- if (!context.parserServices?.defineTemplateBodyVisitor) {
23
+ const parserServices = getParserServices(context);
24
+ if (!parserServices?.defineTemplateBodyVisitor) {
22
25
  return {
23
26
  };
24
27
  }
25
28
 
26
- return context.parserServices.defineTemplateBodyVisitor({
29
+ return parserServices.defineTemplateBodyVisitor({
27
30
  VAttribute(node) {
28
31
  if (!node.key
29
32
  || node.key.type !== 'VDirectiveKey'
@@ -0,0 +1,83 @@
1
+ const { getParserServices } = require('../utils/parser-services');
2
+
3
+ module.exports = {
4
+ meta: {
5
+ type: 'problem',
6
+ schema: [],
7
+ docs: {
8
+ description: 'vue模板中不要在 :style 或 :class 中使用函数调用、模板字符串等复杂表达式(uni-app 小程序下不支持)',
9
+ },
10
+ messages: {
11
+ funcStyleError: 'Do not use function call in :style binding, use computed property or `\'\' + xxx` instead',
12
+ tplStyleError: 'Do not use template literal in :style binding, use computed property or `\'\' + xxx` instead',
13
+ funcClassError: 'Do not use function call in :class binding, use computed property or `\'\' + xxx` instead',
14
+ tplClassError: 'Do not use template literal in :class binding, use computed property or `\'\' + xxx` instead',
15
+ },
16
+ },
17
+
18
+ create(context) {
19
+ const fileName = context.filename || context.getFilename();
20
+ if (!fileName.endsWith('.vue')) {
21
+ return {};
22
+ }
23
+ const parserServices = getParserServices(context);
24
+ if (!parserServices?.defineTemplateBodyVisitor) {
25
+ return {};
26
+ }
27
+
28
+ /**
29
+ * 检查顶层表达式是否为函数调用或模板字符串
30
+ *
31
+ * 只检测直接绑定到 :style/:class 的顶层表达式,不递归检查子表达式。
32
+ * 因为数组元素、对象属性值、条件表达式分支中的函数调用/模板字符串
33
+ * 在 uni-app 小程序中是支持的,例如:
34
+ * :class="[utils.getClass(...), tClassImage]" — 合法
35
+ * :style="inChat ? imageStyle(item) : ''" — 合法
36
+ * :class="[classPrefix, inChat ? classPrefix + '--chatting' : '', getFileTypeClass(...)]" — 合法
37
+ */
38
+ function checkExpression(expression, attrName) {
39
+ if (!expression) return;
40
+
41
+ const isStyle = attrName === 'style';
42
+ const funcMessageId = isStyle ? 'funcStyleError' : 'funcClassError';
43
+ const tplMessageId = isStyle ? 'tplStyleError' : 'tplClassError';
44
+
45
+ if (expression.type === 'CallExpression') {
46
+ // :style="tool._style(xxx)" / :class="getClass(xxx)"
47
+ context.report({
48
+ node: expression,
49
+ messageId: funcMessageId,
50
+ });
51
+ return;
52
+ }
53
+
54
+ if (expression.type === 'TemplateLiteral') {
55
+ // :style="`color: ${color}`" / :class="`${prefix}-item`"
56
+ context.report({
57
+ node: expression,
58
+ messageId: tplMessageId,
59
+ });
60
+ }
61
+ }
62
+
63
+ return parserServices.defineTemplateBodyVisitor({
64
+ VAttribute(node) {
65
+ if (!node.key
66
+ || node.key.type !== 'VDirectiveKey'
67
+ || node.key?.argument?.type !== 'VIdentifier'
68
+ ) {
69
+ return;
70
+ }
71
+
72
+ const attrName = node.key?.argument?.name;
73
+ if (attrName !== 'style' && attrName !== 'class') {
74
+ return;
75
+ }
76
+
77
+ if (node?.value?.type === 'VExpressionContainer' && node.value.expression) {
78
+ checkExpression(node.value.expression, attrName);
79
+ }
80
+ },
81
+ });
82
+ },
83
+ };
@@ -1,4 +1,4 @@
1
- const utils = require('eslint-plugin-vue/lib/utils');
1
+ const { getParserServices } = require('../utils/parser-services');
2
2
  const TEST_REGEX = /\[[^\](]*\.\d+[a-zA-Z]+[^\]]*\]/;
3
3
 
4
4
 
@@ -27,7 +27,12 @@ module.exports = {
27
27
  const options = context.options[0] || {};
28
28
  const regex = options.regexp ?? TEST_REGEX;
29
29
 
30
- return utils.defineTemplateBodyVisitor(context, {
30
+ const parserServices = getParserServices(context);
31
+ if (!parserServices?.defineTemplateBodyVisitor) {
32
+ return {};
33
+ }
34
+
35
+ return parserServices.defineTemplateBodyVisitor({
31
36
  'VAttribute[key.name=\'class\']'(node) {
32
37
  if (!node.value || node.value.type !== 'VLiteral') return;
33
38
 
@@ -12,7 +12,7 @@ module.exports = {
12
12
  },
13
13
 
14
14
  create(context) {
15
- const fileName = context.getFilename();
15
+ const fileName = context.filename || context.getFilename();
16
16
  if (!fileName.endsWith('.vue')) {
17
17
  return {};
18
18
  }
@@ -50,7 +50,7 @@ module.exports = {
50
50
  const include = options.include || DEFAULT_INCLUDE;
51
51
  const exclude = options.exclude || DEFAULT_EXCLUDE;
52
52
 
53
- const filename = context.getFilename();
53
+ const filename = context.filename || context.getFilename();
54
54
  const pureFilePath = path.relative(projectRoot, filename);
55
55
 
56
56
  if (!pureFilePath) {
@@ -10,9 +10,9 @@ module.exports = {
10
10
  create(context) {
11
11
  return {
12
12
  Program(node) {
13
- const sourceCode = context.getSourceCode();
13
+ const sourceCode = context.sourceCode || context.getSourceCode();
14
14
  const vueFileContent = sourceCode.getText();
15
- const filename = context.getFilename();
15
+ const filename = context.filename || context.getFilename();
16
16
 
17
17
  if (!filename.endsWith('.vue')) {
18
18
  return {};
@@ -1,3 +1,5 @@
1
+ const { getParserServices } = require('../utils/parser-services');
2
+
1
3
  module.exports = {
2
4
  meta: {
3
5
  type: 'problem',
@@ -12,16 +14,17 @@ module.exports = {
12
14
  },
13
15
 
14
16
  create(context) {
15
- const fileName = context.getFilename();
17
+ const fileName = context.filename || context.getFilename();
16
18
  if (!fileName.endsWith('.vue')) {
17
19
  return {};
18
20
  }
19
- if (!context.parserServices?.defineTemplateBodyVisitor) {
21
+ const parserServices = getParserServices(context);
22
+ if (!parserServices?.defineTemplateBodyVisitor) {
20
23
  return {
21
24
  };
22
25
  }
23
26
 
24
- return context.parserServices.defineTemplateBodyVisitor({
27
+ return parserServices.defineTemplateBodyVisitor({
25
28
  VAttribute(node) {
26
29
  if (node.value && node.value.type === 'VExpressionContainer' && node.value.expression) {
27
30
  const { operator } = node.value.expression;
@@ -53,7 +53,7 @@ module.exports = {
53
53
  return {
54
54
  ImportDeclaration(node) {
55
55
  // 获取当前文件的绝对路径
56
- const filename = context.getFilename();
56
+ const filename = context.filename || context.getFilename();
57
57
 
58
58
  // 标准化路径(统一使用正斜杠)
59
59
  const normalizedPath = filename.replace(/\\/g, '/');
@@ -22,13 +22,13 @@ module.exports = {
22
22
  ],
23
23
  },
24
24
  create(context) {
25
- const sourceCode = context.getSourceCode();
25
+ const sourceCode = context.sourceCode || context.getSourceCode();
26
26
  const comments = sourceCode.getAllComments();
27
27
 
28
- comments.forEach((comment) => {
29
- const options = context.options[0] || {};
30
- const keyword = options.keyword ?? DEFAULT_KEYWORD;
28
+ const options = context.options[0] || {};
29
+ const keyword = options.keyword ?? DEFAULT_KEYWORD;
31
30
 
31
+ comments.forEach((comment) => {
32
32
  if (comment.value.includes(keyword)) {
33
33
  context.report({
34
34
  node: comment,
@@ -74,7 +74,7 @@ module.exports = {
74
74
  const exclude = options.exclude || DEFAULT_EXCLUDE;
75
75
 
76
76
 
77
- const filename = context.getFilename();
77
+ const filename = context.filename || context.getFilename();
78
78
  const pureFilePath = path.relative(projectRoot, filename);
79
79
 
80
80
 
@@ -27,8 +27,9 @@ module.exports = {
27
27
  create(context) {
28
28
  const options = context.options[0] || {};
29
29
  const baseDir = options.baseDir || 'src';
30
+ const sourceCode = context.sourceCode || context.getSourceCode();
30
31
 
31
- const filename = context.getFilename();
32
+ const filename = context.filename || context.getFilename();
32
33
  const absolutePath = path.resolve(filename);
33
34
 
34
35
  // 提取当前包名
@@ -114,7 +115,6 @@ module.exports = {
114
115
  */
115
116
  const checkAndReport = (node, importPath) => {
116
117
  if (importPath && importPath.startsWith(pmdPackageName)) {
117
- const sourceCode = context.getSourceCode();
118
118
  const fixNode = getFixNode(node);
119
119
 
120
120
  context.report({
@@ -180,7 +180,7 @@ module.exports = {
180
180
  create(context) {
181
181
  // const sourceCode = context.getSourceCode();
182
182
  // const cwd = context.getCwd();
183
- const fileName = context.getFilename();
183
+ const fileName = context.filename || context.getFilename();
184
184
 
185
185
  const dirname = path.dirname(fileName);
186
186
  if (!fileName.endsWith('.vue')) {
package/lib/test/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ require('./no-complex-style-class');
1
2
  require('./no-decimal-in-brackets');
2
3
  require('./no-direct-img-src');
3
4
  require('./no-non-index-import');
@@ -0,0 +1,85 @@
1
+ const { RuleTester } = require('eslint');
2
+
3
+ const rule = require('../rules/no-complex-style-class');
4
+
5
+ const FILENAME = 'test.vue';
6
+
7
+ const ruleTester = new RuleTester({
8
+ parser: require.resolve('vue-eslint-parser'),
9
+ parserOptions: {
10
+ ecmaVersion: 'latest',
11
+ sourceType: 'module',
12
+ },
13
+ });
14
+
15
+ ruleTester.run('no-complex-style-class', rule, {
16
+ valid: [
17
+ // :style 绑定变量 — 合法
18
+ { code: '<template><div :style="myStyle"></div></template>', filename: FILENAME },
19
+
20
+ // :style 绑定对象(值为变量) — 合法
21
+ { code: '<template><div :style="{ color: myColor }"></div></template>', filename: FILENAME },
22
+
23
+ // :class 绑定变量 — 合法
24
+ { code: '<template><div :class="item.className"></div></template>', filename: FILENAME },
25
+
26
+ // :class 绑定字面量数组 — 合法
27
+ { code: '<template><div :class="[\'a\', \'b\']"></div></template>', filename: FILENAME },
28
+
29
+ // :class 绑定对象 — 合法
30
+ { code: '<template><div :class="{ active: isActive }"></div></template>', filename: FILENAME },
31
+
32
+ // :style 绑定条件表达式(值为变量) — 合法
33
+ { code: '<template><div :style="flag ? styleA : styleB"></div></template>', filename: FILENAME },
34
+
35
+ // 静态 style — 合法(非绑定)
36
+ { code: '<template><div style="color: red"></div></template>', filename: FILENAME },
37
+
38
+ // 静态 class — 合法(非绑定)
39
+ { code: '<template><div class="foo bar"></div></template>', filename: FILENAME },
40
+
41
+ // 数组元素中的函数调用 — 合法(小程序支持)
42
+ { code: '<template><div :class="[utils.getClass(classPrefix, dataSize || \'medium\', dataShape, dataBordered), tClassImage]"></div></template>', filename: FILENAME },
43
+
44
+ // 数组中混合使用函数调用和条件表达式 — 合法
45
+ { code: '<template><div :class="[classPrefix, inChat ? classPrefix + \'--chatting\' : \'\', getFileTypeClass(inChat, files)]"></div></template>', filename: FILENAME },
46
+
47
+ // 条件表达式中的函数调用 — 合法(小程序支持)
48
+ { code: '<template><div :style="inChat ? imageStyle(item) : \'\'"></div></template>', filename: FILENAME },
49
+
50
+ // 对象属性值中的函数调用 — 合法(小程序支持)
51
+ { code: '<template><div :style="{ color: getColor() }"></div></template>', filename: FILENAME },
52
+
53
+ // 条件表达式分支中的函数调用 — 合法
54
+ { code: '<template><div :style="flag ? getStyle() : defaultStyle"></div></template>', filename: FILENAME },
55
+
56
+ // 数组中有多个函数调用 — 合法
57
+ { code: '<template><div :class="[getA(), getB()]"></div></template>', filename: FILENAME },
58
+ ],
59
+ invalid: [
60
+ // :style 中直接使用函数调用(顶层)
61
+ {
62
+ code: '<template><div :style="tool._style(xxx)"></div></template>',
63
+ filename: FILENAME,
64
+ errors: [{ messageId: 'funcStyleError' }],
65
+ },
66
+ // :class 中直接使用函数调用(顶层)
67
+ {
68
+ code: '<template><div :class="getClass(item)"></div></template>',
69
+ filename: FILENAME,
70
+ errors: [{ messageId: 'funcClassError' }],
71
+ },
72
+ // :style 中直接使用模板字符串(顶层)
73
+ {
74
+ code: '<template><div :style="`color: ${color}`"></div></template>',
75
+ filename: FILENAME,
76
+ errors: [{ messageId: 'tplStyleError' }],
77
+ },
78
+ // :class 中直接使用模板字符串(顶层)
79
+ {
80
+ code: '<template><div :class="`${prefix}-item`"></div></template>',
81
+ filename: FILENAME,
82
+ errors: [{ messageId: 'tplClassError' }],
83
+ },
84
+ ],
85
+ });
@@ -0,0 +1,26 @@
1
+ /**
2
+ * 获取 parserServices,兼容 ESLint v8 和 v9
3
+ *
4
+ * ESLint v9 中 context.parserServices 已被废弃,
5
+ * 应使用 context.sourceCode.parserServices 代替。
6
+ *
7
+ * @param {import('eslint').Rule.RuleContext} context
8
+ * @returns {object} parserServices
9
+ */
10
+ function getParserServices(context) {
11
+ // ESLint v9+: 优先使用 sourceCode.parserServices
12
+ if (context.sourceCode && context.sourceCode.parserServices) {
13
+ return context.sourceCode.parserServices;
14
+ }
15
+ // ESLint v8: getSourceCode() 方式
16
+ if (typeof context.getSourceCode === 'function') {
17
+ const sourceCode = context.getSourceCode();
18
+ if (sourceCode && sourceCode.parserServices) {
19
+ return sourceCode.parserServices;
20
+ }
21
+ }
22
+ // 最终回退到 context.parserServices
23
+ return context.parserServices || {};
24
+ }
25
+
26
+ module.exports = { getParserServices };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-light",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "Simple Eslint Plugin",
5
5
  "keywords": [
6
6
  "eslint",
@@ -25,6 +25,8 @@
25
25
  "CHANGELOG.md"
26
26
  ],
27
27
  "dependencies": {
28
+ "@tdesign/uniapp": "^0.7.3",
29
+ "@tdesign/uniapp-chat": "^0.2.1",
28
30
  "minimatch": "^10.0.1",
29
31
  "requireindex": "^1.2.0",
30
32
  "t-comm": "^3.0.22"
@@ -48,6 +50,10 @@
48
50
  "engines": {
49
51
  "node": "12.x || 14.x || >= 16"
50
52
  },
53
+ "publishConfig": {
54
+ "access": "public",
55
+ "registry": "https://registry.npmjs.org/"
56
+ },
51
57
  "scripts": {
52
58
  "build": "rm -rf lib && node script/build",
53
59
  "bump": "node ../../script/monorepo/version-simple $PWD",