@saasmakers/eslint 1.0.24 → 1.0.25

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.
@@ -10764,7 +10764,7 @@ const eslint_config = antfu__default(
10764
10764
  test: false,
10765
10765
  typescript: true,
10766
10766
  unocss: true,
10767
- vue: { a11y: true }
10767
+ vue: true
10768
10768
  },
10769
10769
  // Antfu changes (keep them minimal)
10770
10770
  {
@@ -44,7 +44,7 @@ var eslint_config = antfu(
44
44
  test: false,
45
45
  typescript: true,
46
46
  unocss: true,
47
- vue: { a11y: true }
47
+ vue: true
48
48
  },
49
49
  // Antfu changes (keep them minimal)
50
50
  {
@@ -44,7 +44,7 @@ var eslint_config = antfu(
44
44
  test: false,
45
45
  typescript: true,
46
46
  unocss: true,
47
- vue: { a11y: true }
47
+ vue: true
48
48
  },
49
49
  // Antfu changes (keep them minimal)
50
50
  {
@@ -44,7 +44,7 @@ var eslint_config = antfu(
44
44
  test: false,
45
45
  typescript: true,
46
46
  unocss: true,
47
- vue: { a11y: true }
47
+ vue: true
48
48
  },
49
49
  // Antfu changes (keep them minimal)
50
50
  {
@@ -10738,7 +10738,7 @@ const eslint_config = antfu(
10738
10738
  test: false,
10739
10739
  typescript: true,
10740
10740
  unocss: true,
10741
- vue: { a11y: true }
10741
+ vue: true
10742
10742
  },
10743
10743
  // Antfu changes (keep them minimal)
10744
10744
  {
package/dist/index.cjs CHANGED
@@ -838,9 +838,10 @@ const dollarTPatterns = [
838
838
  const rule = {
839
839
  defaultOptions: [],
840
840
  meta: {
841
- docs: { description: 'Format Vue templates: strip unnecessary props/$props prefixes, redundant ="true" attributes (except aria- attributes), enforce t() over $t(), and require "on" prefix on named event listener handlers' },
841
+ docs: { description: 'Format Vue templates: strip unnecessary props/$props prefixes, redundant ="true" attributes (except aria- attributes), enforce t() over $t(), require "on" prefix on named event listener handlers, and disallow inline event handler expressions' },
842
842
  fixable: "code",
843
843
  messages: {
844
+ eventHandlerMustBeFunction: 'Event listener must reference a named handler function (e.g. @click="onClose") or call one (e.g. @click="onClose($event)"). Inline expressions are not allowed.',
844
845
  noPropsPrefix: "Unnecessary props/$props prefix in template. Props are automatically available in template scope.",
845
846
  prefixEventHandlerWithOn: 'Event listener handler "{{name}}" must be prefixed with "on" (e.g. @click="onClick").',
846
847
  removeTrueAttribute: 'Unnecessary ="true" attribute. Use the attribute name directly instead.',
@@ -922,24 +923,36 @@ const rule = {
922
923
  while (eventHandlerMatch !== null) {
923
924
  const handlerValue = eventHandlerMatch[1].trim();
924
925
  let handlerName;
926
+ let isBareIdentifier = false;
927
+ let isSingleCall = false;
925
928
  if (bareIdentifierRegex.test(handlerValue)) {
926
929
  handlerName = handlerValue;
930
+ isBareIdentifier = true;
927
931
  } else {
928
932
  const singleCallMatch = singleCallRegex.exec(handlerValue);
929
933
  if (singleCallMatch) {
930
934
  handlerName = singleCallMatch[1];
935
+ isSingleCall = true;
931
936
  }
932
937
  }
933
- if (handlerName && !exemptCallees.has(handlerName) && !onPrefixRegex.test(handlerName)) {
934
- const valueStart = templateStartIndex + eventHandlerMatch.index + eventHandlerMatch[0].length - 1 - eventHandlerMatch[1].length;
935
- const valueEnd = valueStart + eventHandlerMatch[1].length;
938
+ const valueStart = templateStartIndex + eventHandlerMatch.index + eventHandlerMatch[0].length - 1 - eventHandlerMatch[1].length;
939
+ const valueEnd = valueStart + eventHandlerMatch[1].length;
940
+ const handlerLoc = {
941
+ end: sourceCode.getLocFromIndex(valueEnd),
942
+ start: sourceCode.getLocFromIndex(valueStart)
943
+ };
944
+ if (isBareIdentifier || isSingleCall) {
945
+ if (handlerName && !exemptCallees.has(handlerName) && !onPrefixRegex.test(handlerName)) {
946
+ context.report({
947
+ data: { name: handlerName },
948
+ loc: handlerLoc,
949
+ messageId: "prefixEventHandlerWithOn"
950
+ });
951
+ }
952
+ } else {
936
953
  context.report({
937
- data: { name: handlerName },
938
- loc: {
939
- end: sourceCode.getLocFromIndex(valueEnd),
940
- start: sourceCode.getLocFromIndex(valueStart)
941
- },
942
- messageId: "prefixEventHandlerWithOn"
954
+ loc: handlerLoc,
955
+ messageId: "eventHandlerMustBeFunction"
943
956
  });
944
957
  }
945
958
  eventHandlerMatch = eventHandlerRegex.exec(templateContent);
package/dist/index.d.cts CHANGED
@@ -5203,7 +5203,7 @@ declare const _default: {
5203
5203
  locales?: string[];
5204
5204
  } | undefined)?], unknown, RuleListener>;
5205
5205
  'vue-format-script': RuleModule<"multilineComputed" | "untypedEmits", [], unknown, RuleListener>;
5206
- 'vue-format-template': RuleModule<"noPropsPrefix" | "prefixEventHandlerWithOn" | "removeTrueAttribute" | "useT", [], unknown, RuleListener>;
5206
+ 'vue-format-template': RuleModule<"eventHandlerMustBeFunction" | "noPropsPrefix" | "prefixEventHandlerWithOn" | "removeTrueAttribute" | "useT", [], unknown, RuleListener>;
5207
5207
  };
5208
5208
  };
5209
5209
 
package/dist/index.d.mts CHANGED
@@ -5203,7 +5203,7 @@ declare const _default: {
5203
5203
  locales?: string[];
5204
5204
  } | undefined)?], unknown, RuleListener>;
5205
5205
  'vue-format-script': RuleModule<"multilineComputed" | "untypedEmits", [], unknown, RuleListener>;
5206
- 'vue-format-template': RuleModule<"noPropsPrefix" | "prefixEventHandlerWithOn" | "removeTrueAttribute" | "useT", [], unknown, RuleListener>;
5206
+ 'vue-format-template': RuleModule<"eventHandlerMustBeFunction" | "noPropsPrefix" | "prefixEventHandlerWithOn" | "removeTrueAttribute" | "useT", [], unknown, RuleListener>;
5207
5207
  };
5208
5208
  };
5209
5209
 
package/dist/index.d.ts CHANGED
@@ -5203,7 +5203,7 @@ declare const _default: {
5203
5203
  locales?: string[];
5204
5204
  } | undefined)?], unknown, RuleListener>;
5205
5205
  'vue-format-script': RuleModule<"multilineComputed" | "untypedEmits", [], unknown, RuleListener>;
5206
- 'vue-format-template': RuleModule<"noPropsPrefix" | "prefixEventHandlerWithOn" | "removeTrueAttribute" | "useT", [], unknown, RuleListener>;
5206
+ 'vue-format-template': RuleModule<"eventHandlerMustBeFunction" | "noPropsPrefix" | "prefixEventHandlerWithOn" | "removeTrueAttribute" | "useT", [], unknown, RuleListener>;
5207
5207
  };
5208
5208
  };
5209
5209
 
package/dist/index.mjs CHANGED
@@ -836,9 +836,10 @@ const dollarTPatterns = [
836
836
  const rule = {
837
837
  defaultOptions: [],
838
838
  meta: {
839
- docs: { description: 'Format Vue templates: strip unnecessary props/$props prefixes, redundant ="true" attributes (except aria- attributes), enforce t() over $t(), and require "on" prefix on named event listener handlers' },
839
+ docs: { description: 'Format Vue templates: strip unnecessary props/$props prefixes, redundant ="true" attributes (except aria- attributes), enforce t() over $t(), require "on" prefix on named event listener handlers, and disallow inline event handler expressions' },
840
840
  fixable: "code",
841
841
  messages: {
842
+ eventHandlerMustBeFunction: 'Event listener must reference a named handler function (e.g. @click="onClose") or call one (e.g. @click="onClose($event)"). Inline expressions are not allowed.',
842
843
  noPropsPrefix: "Unnecessary props/$props prefix in template. Props are automatically available in template scope.",
843
844
  prefixEventHandlerWithOn: 'Event listener handler "{{name}}" must be prefixed with "on" (e.g. @click="onClick").',
844
845
  removeTrueAttribute: 'Unnecessary ="true" attribute. Use the attribute name directly instead.',
@@ -920,24 +921,36 @@ const rule = {
920
921
  while (eventHandlerMatch !== null) {
921
922
  const handlerValue = eventHandlerMatch[1].trim();
922
923
  let handlerName;
924
+ let isBareIdentifier = false;
925
+ let isSingleCall = false;
923
926
  if (bareIdentifierRegex.test(handlerValue)) {
924
927
  handlerName = handlerValue;
928
+ isBareIdentifier = true;
925
929
  } else {
926
930
  const singleCallMatch = singleCallRegex.exec(handlerValue);
927
931
  if (singleCallMatch) {
928
932
  handlerName = singleCallMatch[1];
933
+ isSingleCall = true;
929
934
  }
930
935
  }
931
- if (handlerName && !exemptCallees.has(handlerName) && !onPrefixRegex.test(handlerName)) {
932
- const valueStart = templateStartIndex + eventHandlerMatch.index + eventHandlerMatch[0].length - 1 - eventHandlerMatch[1].length;
933
- const valueEnd = valueStart + eventHandlerMatch[1].length;
936
+ const valueStart = templateStartIndex + eventHandlerMatch.index + eventHandlerMatch[0].length - 1 - eventHandlerMatch[1].length;
937
+ const valueEnd = valueStart + eventHandlerMatch[1].length;
938
+ const handlerLoc = {
939
+ end: sourceCode.getLocFromIndex(valueEnd),
940
+ start: sourceCode.getLocFromIndex(valueStart)
941
+ };
942
+ if (isBareIdentifier || isSingleCall) {
943
+ if (handlerName && !exemptCallees.has(handlerName) && !onPrefixRegex.test(handlerName)) {
944
+ context.report({
945
+ data: { name: handlerName },
946
+ loc: handlerLoc,
947
+ messageId: "prefixEventHandlerWithOn"
948
+ });
949
+ }
950
+ } else {
934
951
  context.report({
935
- data: { name: handlerName },
936
- loc: {
937
- end: sourceCode.getLocFromIndex(valueEnd),
938
- start: sourceCode.getLocFromIndex(valueStart)
939
- },
940
- messageId: "prefixEventHandlerWithOn"
952
+ loc: handlerLoc,
953
+ messageId: "eventHandlerMustBeFunction"
941
954
  });
942
955
  }
943
956
  eventHandlerMatch = eventHandlerRegex.exec(templateContent);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saasmakers/eslint",
3
- "version": "1.0.24",
3
+ "version": "1.0.25",
4
4
  "private": false,
5
5
  "description": "Shared ESLint config and rules for SaaS Makers projects",
6
6
  "license": "MIT",