@so1ve/eslint-plugin 0.42.1 → 0.42.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/dist/index.cjs CHANGED
@@ -412,12 +412,11 @@ const noSpacesBeforeParen = createEslintRule({
412
412
  },
413
413
  CallExpression(node) {
414
414
  const caller = "property" in node.callee ? node.callee.property : node.callee;
415
- const firstArgument = node.arguments[0];
416
- const firstArgumentStart = firstArgument ? firstArgument.range[0] : void 0;
417
- const parenStart = firstArgument ? firstArgumentStart - 1 : node.range[1] - 2;
415
+ const textAfterCaller = text.slice(caller.range[1]);
416
+ const parenStart = caller.range[1] + textAfterCaller.indexOf("(");
418
417
  const textBetweenFunctionNameAndParenRange = [caller.range[1], parenStart];
419
418
  const textBetweenFunctionNameAndParen = text.slice(...textBetweenFunctionNameAndParenRange);
420
- const hasGenerics = !/^\s*$/.test(textBetweenFunctionNameAndParen);
419
+ const hasGenerics = textBetweenFunctionNameAndParen.includes("<");
421
420
  if (!hasGenerics) {
422
421
  if (textBetweenFunctionNameAndParen.length > 0) {
423
422
  context.report({
package/dist/index.mjs CHANGED
@@ -410,12 +410,11 @@ const noSpacesBeforeParen = createEslintRule({
410
410
  },
411
411
  CallExpression(node) {
412
412
  const caller = "property" in node.callee ? node.callee.property : node.callee;
413
- const firstArgument = node.arguments[0];
414
- const firstArgumentStart = firstArgument ? firstArgument.range[0] : void 0;
415
- const parenStart = firstArgument ? firstArgumentStart - 1 : node.range[1] - 2;
413
+ const textAfterCaller = text.slice(caller.range[1]);
414
+ const parenStart = caller.range[1] + textAfterCaller.indexOf("(");
416
415
  const textBetweenFunctionNameAndParenRange = [caller.range[1], parenStart];
417
416
  const textBetweenFunctionNameAndParen = text.slice(...textBetweenFunctionNameAndParenRange);
418
- const hasGenerics = !/^\s*$/.test(textBetweenFunctionNameAndParen);
417
+ const hasGenerics = textBetweenFunctionNameAndParen.includes("<");
419
418
  if (!hasGenerics) {
420
419
  if (textBetweenFunctionNameAndParen.length > 0) {
421
420
  context.report({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@so1ve/eslint-plugin",
3
- "version": "0.42.1",
3
+ "version": "0.42.2",
4
4
  "author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
5
5
  "contributors": [
6
6
  {