@vue-vine/eslint-parser 0.1.9 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -7959,7 +7959,7 @@ function isBasicParserObject(value) {
7959
7959
  }
7960
7960
 
7961
7961
  // src/script/scope-analyzer.ts
7962
- var _scopemanager = require('@typescript-eslint/scope-manager'); var tsEscopeTypes = _interopRequireWildcard(_scopemanager);
7962
+ var _scopemanager = require('@typescript-eslint/scope-manager'); var tsEscopeTypes2 = _interopRequireWildcard(_scopemanager); var tsEscopeTypes = _interopRequireWildcard(_scopemanager);
7963
7963
 
7964
7964
  // src/common/eslint-scope.ts
7965
7965
  var _eslintscope = require('eslint-scope'); var escope = _interopRequireWildcard(_eslintscope);
@@ -7975,6 +7975,29 @@ function getEslintScope() {
7975
7975
  return escopeCache;
7976
7976
  }
7977
7977
 
7978
+ // src/common/vine-specific.ts
7979
+
7980
+ function createVirtualVineFnPropsReference({
7981
+ compFnPropsIdentifier,
7982
+ foundVCFScope
7983
+ }) {
7984
+ const virtualReference = new tsEscopeTypes.Reference(
7985
+ compFnPropsIdentifier,
7986
+ foundVCFScope,
7987
+ 1 /* Read */,
7988
+ void 0,
7989
+ void 0,
7990
+ void 0,
7991
+ 1 /* Value */
7992
+ );
7993
+ virtualReference.isWrite = () => false;
7994
+ virtualReference.isWriteOnly = () => false;
7995
+ virtualReference.isRead = () => true;
7996
+ virtualReference.isReadOnly = () => true;
7997
+ virtualReference.isReadWrite = () => false;
7998
+ return virtualReference;
7999
+ }
8000
+
7978
8001
  // src/script/scope-analyzer.ts
7979
8002
  var BUILTIN_COMPONENTS = /* @__PURE__ */ new Set([
7980
8003
  "template",
@@ -8109,6 +8132,18 @@ function collectVariablesForVCF(tsFileScopeManager, templateRoot) {
8109
8132
  for (const variable of foundVCFScope.variables) {
8110
8133
  scriptVariables.set(variable.name, variable);
8111
8134
  }
8135
+ const compFnPropsIdentifier = _optionalChain([foundVCF, 'access', _13 => _13.params, 'optionalAccess', _14 => _14[0], 'optionalAccess', _15 => _15.type]) === "Identifier" && _optionalChain([foundVCF, 'access', _16 => _16.params, 'access', _17 => _17[0], 'optionalAccess', _18 => _18.name]) === "props" ? foundVCF.params[0] : null;
8136
+ const propsVar = scriptVariables.get("props");
8137
+ if (compFnPropsIdentifier && propsVar) {
8138
+ ;
8139
+ propsVar.eslintUsed = true;
8140
+ propsVar.references.push(
8141
+ createVirtualVineFnPropsReference({
8142
+ foundVCFScope,
8143
+ compFnPropsIdentifier
8144
+ })
8145
+ );
8146
+ }
8112
8147
  }
8113
8148
  }
8114
8149
  }
@@ -8153,7 +8188,7 @@ function analyzeUsedInTemplateVariables(scopeManager, templateRoot) {
8153
8188
  return;
8154
8189
  }
8155
8190
  markedVariables.add(name);
8156
- const reference = new tsEscopeTypes.Reference(
8191
+ const reference = new tsEscopeTypes2.Reference(
8157
8192
  variable.identifiers[0],
8158
8193
  variable.scope,
8159
8194
  1 /* Read */,
@@ -8224,8 +8259,8 @@ function analyzeUsedInTemplateVariables(scopeManager, templateRoot) {
8224
8259
  var ALIAS_ITERATOR = /^([\s\S]*?(?:\s|\)))(\bin\b|\bof\b)([\s\S]*)$/u;
8225
8260
  var PARENS = /^(\s*\()([\s\S]*?)(\)\s*)$/u;
8226
8261
  var DUMMY_PARENT2 = {};
8227
- var IS_FUNCTION_EXPRESSION = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/u;
8228
- var IS_SIMPLE_PATH = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?'\]|\["[^"]*?"\]|\[\d+\]|\[[A-Za-z_$][\w$]*\])*$/u;
8262
+ var IS_FUNCTION_EXPRESSION = /^\s*(?:[\w$]+|\([^)]*\))\s*=>|^function\s*\(/u;
8263
+ var IS_SIMPLE_PATH = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*'\]|\["[^"]*"\]|\[\d+\]|\[[A-Za-z_$][\w$]*\])*$/u;
8229
8264
  function processVForAliasAndIterator(code) {
8230
8265
  const match = ALIAS_ITERATOR.exec(code);
8231
8266
  if (match != null) {
@@ -8311,7 +8346,7 @@ function parseScriptFragment(code, locationCalculator, vineFixLocationContext, p
8311
8346
  throw err;
8312
8347
  }
8313
8348
  }
8314
- var validDivisionCharRE = /[\w).+\-_$\]]/u;
8349
+ var validDivisionCharRE = /[\w).+\-$\]]/u;
8315
8350
  function splitFilters(exp) {
8316
8351
  const result = [];
8317
8352
  let inSingle = false;
@@ -8993,7 +9028,7 @@ function parseSlotScopeExpression(code, locationCalculator, vineFixLocationConte
8993
9028
  // src/template/utils/index.ts
8994
9029
  var shorthandSign = /^[.:@#]/u;
8995
9030
  var shorthandNameMap = { ":": "bind", ".": "bind", "@": "on", "#": "slot" };
8996
- var invalidDynamicArgumentNextChar = /^[\s\r\n=/>]$/u;
9031
+ var invalidDynamicArgumentNextChar = /^[\s=/>]$/u;
8997
9032
  function isPropModifier(node) {
8998
9033
  return node.name === "prop";
8999
9034
  }
@@ -10011,12 +10046,11 @@ function prepareForTemplateRootAST(tsFileAST) {
10011
10046
  return [];
10012
10047
  }
10013
10048
  return extractResults.map((extractResult) => {
10014
- const { templateNode, parentOfTemplate, bindVineTemplateESTree } = extractResult;
10049
+ const { templateNode, ...restOfExtractResult } = extractResult;
10015
10050
  return {
10016
10051
  templateNode,
10017
- parentOfTemplate,
10018
- bindVineTemplateESTree,
10019
- ...prepareTemplate(templateNode)
10052
+ ...prepareTemplate(templateNode),
10053
+ ...restOfExtractResult
10020
10054
  };
10021
10055
  });
10022
10056
  }
package/dist/index.mjs CHANGED
@@ -7959,7 +7959,7 @@ function isBasicParserObject(value) {
7959
7959
  }
7960
7960
 
7961
7961
  // src/script/scope-analyzer.ts
7962
- import * as tsEscopeTypes from "@typescript-eslint/scope-manager";
7962
+ import * as tsEscopeTypes2 from "@typescript-eslint/scope-manager";
7963
7963
 
7964
7964
  // src/common/eslint-scope.ts
7965
7965
  import * as escope from "eslint-scope";
@@ -7975,6 +7975,29 @@ function getEslintScope() {
7975
7975
  return escopeCache;
7976
7976
  }
7977
7977
 
7978
+ // src/common/vine-specific.ts
7979
+ import * as tsEscopeTypes from "@typescript-eslint/scope-manager";
7980
+ function createVirtualVineFnPropsReference({
7981
+ compFnPropsIdentifier,
7982
+ foundVCFScope
7983
+ }) {
7984
+ const virtualReference = new tsEscopeTypes.Reference(
7985
+ compFnPropsIdentifier,
7986
+ foundVCFScope,
7987
+ 1 /* Read */,
7988
+ void 0,
7989
+ void 0,
7990
+ void 0,
7991
+ 1 /* Value */
7992
+ );
7993
+ virtualReference.isWrite = () => false;
7994
+ virtualReference.isWriteOnly = () => false;
7995
+ virtualReference.isRead = () => true;
7996
+ virtualReference.isReadOnly = () => true;
7997
+ virtualReference.isReadWrite = () => false;
7998
+ return virtualReference;
7999
+ }
8000
+
7978
8001
  // src/script/scope-analyzer.ts
7979
8002
  var BUILTIN_COMPONENTS = /* @__PURE__ */ new Set([
7980
8003
  "template",
@@ -8109,6 +8132,18 @@ function collectVariablesForVCF(tsFileScopeManager, templateRoot) {
8109
8132
  for (const variable of foundVCFScope.variables) {
8110
8133
  scriptVariables.set(variable.name, variable);
8111
8134
  }
8135
+ const compFnPropsIdentifier = foundVCF.params?.[0]?.type === "Identifier" && foundVCF.params[0]?.name === "props" ? foundVCF.params[0] : null;
8136
+ const propsVar = scriptVariables.get("props");
8137
+ if (compFnPropsIdentifier && propsVar) {
8138
+ ;
8139
+ propsVar.eslintUsed = true;
8140
+ propsVar.references.push(
8141
+ createVirtualVineFnPropsReference({
8142
+ foundVCFScope,
8143
+ compFnPropsIdentifier
8144
+ })
8145
+ );
8146
+ }
8112
8147
  }
8113
8148
  }
8114
8149
  }
@@ -8153,7 +8188,7 @@ function analyzeUsedInTemplateVariables(scopeManager, templateRoot) {
8153
8188
  return;
8154
8189
  }
8155
8190
  markedVariables.add(name);
8156
- const reference = new tsEscopeTypes.Reference(
8191
+ const reference = new tsEscopeTypes2.Reference(
8157
8192
  variable.identifiers[0],
8158
8193
  variable.scope,
8159
8194
  1 /* Read */,
@@ -8224,8 +8259,8 @@ function analyzeUsedInTemplateVariables(scopeManager, templateRoot) {
8224
8259
  var ALIAS_ITERATOR = /^([\s\S]*?(?:\s|\)))(\bin\b|\bof\b)([\s\S]*)$/u;
8225
8260
  var PARENS = /^(\s*\()([\s\S]*?)(\)\s*)$/u;
8226
8261
  var DUMMY_PARENT2 = {};
8227
- var IS_FUNCTION_EXPRESSION = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/u;
8228
- var IS_SIMPLE_PATH = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?'\]|\["[^"]*?"\]|\[\d+\]|\[[A-Za-z_$][\w$]*\])*$/u;
8262
+ var IS_FUNCTION_EXPRESSION = /^\s*(?:[\w$]+|\([^)]*\))\s*=>|^function\s*\(/u;
8263
+ var IS_SIMPLE_PATH = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*'\]|\["[^"]*"\]|\[\d+\]|\[[A-Za-z_$][\w$]*\])*$/u;
8229
8264
  function processVForAliasAndIterator(code) {
8230
8265
  const match = ALIAS_ITERATOR.exec(code);
8231
8266
  if (match != null) {
@@ -8311,7 +8346,7 @@ function parseScriptFragment(code, locationCalculator, vineFixLocationContext, p
8311
8346
  throw err;
8312
8347
  }
8313
8348
  }
8314
- var validDivisionCharRE = /[\w).+\-_$\]]/u;
8349
+ var validDivisionCharRE = /[\w).+\-$\]]/u;
8315
8350
  function splitFilters(exp) {
8316
8351
  const result = [];
8317
8352
  let inSingle = false;
@@ -8993,7 +9028,7 @@ function parseSlotScopeExpression(code, locationCalculator, vineFixLocationConte
8993
9028
  // src/template/utils/index.ts
8994
9029
  var shorthandSign = /^[.:@#]/u;
8995
9030
  var shorthandNameMap = { ":": "bind", ".": "bind", "@": "on", "#": "slot" };
8996
- var invalidDynamicArgumentNextChar = /^[\s\r\n=/>]$/u;
9031
+ var invalidDynamicArgumentNextChar = /^[\s=/>]$/u;
8997
9032
  function isPropModifier(node) {
8998
9033
  return node.name === "prop";
8999
9034
  }
@@ -10011,12 +10046,11 @@ function prepareForTemplateRootAST(tsFileAST) {
10011
10046
  return [];
10012
10047
  }
10013
10048
  return extractResults.map((extractResult) => {
10014
- const { templateNode, parentOfTemplate, bindVineTemplateESTree } = extractResult;
10049
+ const { templateNode, ...restOfExtractResult } = extractResult;
10015
10050
  return {
10016
10051
  templateNode,
10017
- parentOfTemplate,
10018
- bindVineTemplateESTree,
10019
- ...prepareTemplate(templateNode)
10052
+ ...prepareTemplate(templateNode),
10053
+ ...restOfExtractResult
10020
10054
  };
10021
10055
  });
10022
10056
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-vine/eslint-parser",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "ESLint parser for Vue Vine",
5
5
  "author": "ShenQingchuan",
6
6
  "license": "MIT",