eslint-plugin-mpx 0.2.1 → 0.2.2

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/lib/index.js CHANGED
@@ -24,7 +24,8 @@ module.exports = {
24
24
  'valid-wx-if': require('./rules/valid-wx-if'),
25
25
  'valid-wx-model': require('./rules/valid-wx-model'),
26
26
  'script-setup-uses-vars': require('./rules/script-setup-uses-vars'),
27
- eqeqeq: require('./rules/eqeqeq')
27
+ eqeqeq: require('./rules/eqeqeq'),
28
+ 'script-indent': require('./rules/script-indent')
28
29
  },
29
30
  configs: {
30
31
  base: require('./configs/base'),
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @author lishuaishuai
3
+ */
4
+ 'use strict'
5
+
6
+ const indentCommon = require('../utils/indent-common')
7
+
8
+ module.exports = {
9
+ meta: {
10
+ type: 'layout',
11
+ docs: {
12
+ description: 'enforce consistent indentation in `<script>`',
13
+ categories: undefined,
14
+ url: ''
15
+ },
16
+ fixable: 'whitespace',
17
+ schema: [
18
+ {
19
+ anyOf: [{ type: 'integer', minimum: 1 }, { enum: ['tab'] }]
20
+ },
21
+ {
22
+ type: 'object',
23
+ properties: {
24
+ baseIndent: { type: 'integer', minimum: 0 },
25
+ switchCase: { type: 'integer', minimum: 0 },
26
+ ignores: {
27
+ type: 'array',
28
+ items: {
29
+ allOf: [
30
+ { type: 'string' },
31
+ { not: { type: 'string', pattern: ':exit$' } },
32
+ { not: { type: 'string', pattern: '^\\s*$' } }
33
+ ]
34
+ },
35
+ uniqueItems: true,
36
+ additionalItems: false
37
+ }
38
+ },
39
+ additionalProperties: false
40
+ }
41
+ ]
42
+ },
43
+ /** @param {RuleContext} context */
44
+ create(context) {
45
+ return indentCommon.defineVisitor(context, context.getSourceCode(), {})
46
+ }
47
+ }
@@ -54,13 +54,13 @@ module.exports = {
54
54
  * @see https://github.com/vuejs/vue-next/blob/2749c15170ad4913e6530a257db485d4e7ed2283/packages/compiler-core/src/transforms/transformElement.ts#L333
55
55
  * @param {string} name
56
56
  */
57
- function markSetupReferenceVariableAsUsed(name) {
58
- if (scriptVariableNames.has(name)) {
59
- context.markVariableAsUsed(name)
60
- return true
61
- }
62
- return false
63
- }
57
+ // function markSetupReferenceVariableAsUsed(name) {
58
+ // if (scriptVariableNames.has(name)) {
59
+ // context.markVariableAsUsed(name)
60
+ // return true
61
+ // }
62
+ // return false
63
+ // }
64
64
 
65
65
  return utils.defineTemplateBodyVisitor(
66
66
  context,
@@ -72,12 +72,12 @@ module.exports = {
72
72
  context.markVariableAsUsed(ref.id.name)
73
73
  }
74
74
  },
75
- VElement(node) {
76
- if (utils.isMpElementName(node.rawName)) {
77
- return
78
- }
79
- markSetupReferenceVariableAsUsed(node.rawName)
80
- },
75
+ // VElement(node) {
76
+ // if (utils.isMpElementName(node.rawName)) {
77
+ // return
78
+ // }
79
+ // markSetupReferenceVariableAsUsed(node.rawName)
80
+ // },
81
81
  /** @param {VAttribute} node */
82
82
  'VAttribute[directive=false]'(node) {
83
83
  if (node.value) {
@@ -33,7 +33,7 @@ module.exports = {
33
33
  type: 'problem',
34
34
  docs: {
35
35
  description: 'enforce valid `wx:model` directives',
36
- // categories: ['mpx-essential'],
36
+ categories: [],
37
37
  url: 'https://mpx-ecology.github.io/eslint-plugin-mpx/rules/valid-wx-model.html'
38
38
  },
39
39
  fixable: null,