eslint-plugin-vuetify 2.5.0 → 2.5.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.
@@ -3,7 +3,8 @@
3
3
  const {
4
4
  hyphenate,
5
5
  classify,
6
- getAttributes
6
+ getAttributes,
7
+ isVueTemplate
7
8
  } = require('../util/helpers');
8
9
  const {
9
10
  isGridAttribute
@@ -39,6 +40,7 @@ module.exports = {
39
40
  schema: []
40
41
  },
41
42
  create(context) {
43
+ if (!isVueTemplate(context)) return {};
42
44
  return context.sourceCode.parserServices.defineTemplateBodyVisitor({
43
45
  VElement(element) {
44
46
  const tag = classify(element.rawName);
@@ -2,7 +2,8 @@
2
2
 
3
3
  const {
4
4
  classify,
5
- getAttributes
5
+ getAttributes,
6
+ isVueTemplate
6
7
  } = require('../util/helpers');
7
8
 
8
9
  // ------------------------------------------------------------------------------
@@ -24,6 +25,7 @@ module.exports = {
24
25
  }
25
26
  },
26
27
  create(context) {
28
+ if (!isVueTemplate(context)) return {};
27
29
  return context.sourceCode.parserServices.defineTemplateBodyVisitor({
28
30
  VElement(element) {
29
31
  const tag = classify(element.rawName);
@@ -1,5 +1,9 @@
1
1
  'use strict';
2
2
 
3
+ const {
4
+ isVueTemplate
5
+ } = require('../util/helpers');
6
+
3
7
  /** @type {Map<RegExp, ((args: string[]) => string | false) | false> | Map<string, string | false>} */
4
8
  const replacements = new Map([[/^rounded-(r|l|tr|tl|br|bl)(-.*)?$/, ([side, rest]) => {
5
9
  side = {
@@ -30,6 +34,7 @@ module.exports = {
30
34
  }
31
35
  },
32
36
  create(context) {
37
+ if (!isVueTemplate(context)) return {};
33
38
  return context.sourceCode.parserServices.defineTemplateBodyVisitor({
34
39
  'VAttribute[key.name="class"]'(node) {
35
40
  if (!node.value || !node.value.value) return;
@@ -1,5 +1,8 @@
1
1
  'use strict';
2
2
 
3
+ const {
4
+ isVueTemplate
5
+ } = require('../util/helpers');
3
6
  const cssColors = ['red', 'pink', 'purple', 'deep-purple', 'indigo', 'blue', 'light-blue', 'cyan', 'teal', 'green', 'light-green', 'lime', 'yellow', 'amber', 'orange', 'deep-orange', 'brown', 'blue-grey', 'grey', 'black', 'white', 'transparent'];
4
7
  const cssTextColors = cssColors.map(v => `${v}--text`);
5
8
  const variants = ['lighten-1', 'lighten-2', 'lighten-3', 'lighten-4', 'lighten-5', 'darken-1', 'darken-2', 'darken-3', 'darken-4', 'accent-1', 'accent-2', 'accent-3', 'accent-4'];
@@ -33,6 +36,7 @@ module.exports = {
33
36
  }
34
37
  },
35
38
  create(context) {
39
+ if (!isVueTemplate(context)) return {};
36
40
  const themeColors = ['primary', 'secondary', 'accent', 'error', 'warning', 'info', 'success', ...(context.options[0]?.themeColors || [])];
37
41
  const themeTextColors = themeColors.map(v => `${v}--text`);
38
42
  function findColor(classes) {
@@ -2,7 +2,8 @@
2
2
 
3
3
  const {
4
4
  hyphenate,
5
- classify
5
+ classify,
6
+ isVueTemplate
6
7
  } = require('../util/helpers');
7
8
  const replacements = {
8
9
  VListTile: 'v-list-item',
@@ -60,6 +61,7 @@ module.exports = {
60
61
  }
61
62
  },
62
63
  create(context) {
64
+ if (!isVueTemplate(context)) return {};
63
65
  return context.sourceCode.parserServices.defineTemplateBodyVisitor({
64
66
  VElement(element) {
65
67
  const tag = classify(element.rawName);
@@ -2,7 +2,8 @@
2
2
 
3
3
  const {
4
4
  hyphenate,
5
- classify
5
+ classify,
6
+ isVueTemplate
6
7
  } = require('../util/helpers');
7
8
  const model = {
8
9
  input: 'update:modelValue'
@@ -156,6 +157,7 @@ module.exports = {
156
157
  }
157
158
  },
158
159
  create(context) {
160
+ if (!isVueTemplate(context)) return {};
159
161
  return context.sourceCode.parserServices.defineTemplateBodyVisitor({
160
162
  VAttribute(attr) {
161
163
  if (!(attr.directive && attr.key.name.name === 'on' && attr.key.argument?.type === 'VIdentifier')) return;
@@ -2,7 +2,8 @@
2
2
 
3
3
  const {
4
4
  hyphenate,
5
- classify
5
+ classify,
6
+ isVueTemplate
6
7
  } = require('../util/helpers');
7
8
  const size = {
8
9
  maxHeight: false,
@@ -938,6 +939,7 @@ module.exports = {
938
939
  }
939
940
  },
940
941
  create(context) {
942
+ if (!isVueTemplate(context)) return {};
941
943
  return context.sourceCode.parserServices.defineTemplateBodyVisitor({
942
944
  VStartTag(tag) {
943
945
  const attrGroups = {};
@@ -2,7 +2,8 @@
2
2
 
3
3
  const {
4
4
  classify,
5
- getAttributes
5
+ getAttributes,
6
+ isVueTemplate
6
7
  } = require('../util/helpers');
7
8
  const groups = [{
8
9
  components: ['VDialog', 'VMenu', 'VTooltip'],
@@ -187,6 +188,7 @@ module.exports = {
187
188
  }
188
189
  },
189
190
  create(context) {
191
+ if (!isVueTemplate(context)) return {};
190
192
  let scopeStack;
191
193
  return context.sourceCode.parserServices.defineTemplateBodyVisitor({
192
194
  VElement(node) {
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ const path = require('node:path');
3
4
  function hyphenate(/* istanbul ignore next */
4
5
  str = '') {
5
6
  return str.replace(/\B([A-Z])/g, '-$1').toLowerCase();
@@ -41,11 +42,18 @@ function mergeDeep(source, target) {
41
42
  }
42
43
  return source;
43
44
  }
45
+ function isVueTemplate(context) {
46
+ if (context.sourceCode.parserServices.defineTemplateBodyVisitor == null) {
47
+ return path.extname(context.getFilename()) === '.vue';
48
+ }
49
+ return true;
50
+ }
44
51
  module.exports = {
45
52
  hyphenate,
46
53
  classify,
47
54
  isBuiltinAttribute,
48
55
  getAttributes,
49
56
  isObject,
50
- mergeDeep
57
+ mergeDeep,
58
+ isVueTemplate
51
59
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-vuetify",
3
- "version": "2.5.0",
3
+ "version": "2.5.2",
4
4
  "description": "An eslint plugin for Vuetify",
5
5
  "main": "lib/index.js",
6
6
  "author": "Kael Watts-Deuchar <kaelwd@gmail.com>",
@@ -20,7 +20,7 @@
20
20
  ],
21
21
  "homepage": "https://github.com/vuetifyjs/eslint-plugin-vuetify#readme",
22
22
  "dependencies": {
23
- "eslint-plugin-vue": "^9.6.0",
23
+ "eslint-plugin-vue": ">=9.6.0",
24
24
  "requireindex": "^1.2.0"
25
25
  },
26
26
  "devDependencies": {
@@ -31,16 +31,17 @@
31
31
  "conventional-changelog-cli": "^2.2.2",
32
32
  "conventional-changelog-vuetify": "^1.1.0",
33
33
  "conventional-github-releaser": "^3.1.5",
34
- "eslint": "^9.14.0",
34
+ "eslint": "^9.22.0",
35
35
  "eslint8": "npm:eslint@8.57.1",
36
+ "eslint-plugin-vue": "^10.0.0",
36
37
  "husky": "^8.0.1",
37
38
  "mocha": "^10.1.0",
38
39
  "neostandard": "^0.11.8",
39
40
  "nyc": "^15.1.0",
40
41
  "rimraf": "^3.0.2",
41
- "vue": "^3.5.12",
42
- "vue-eslint-parser": "^9.4.3",
43
- "vuetify": "^3.7.4"
42
+ "vue": "^3.5.13",
43
+ "vue-eslint-parser": "^10.1.1",
44
+ "vuetify": "^3.7.17"
44
45
  },
45
46
  "peerDependencies": {
46
47
  "eslint": "^8.0.0 || ^9.0.0",