@typescript-eslint/parser
Advanced tools
Comparing version 1.2.1-alpha.16 to 1.2.1-alpha.18
@@ -69,2 +69,5 @@ "use strict"; | ||
super.RestElement(node); | ||
if (node.decorators) { | ||
this.rightHandNodes.push(...node.decorators); | ||
} | ||
if (node.typeAnnotation) { | ||
@@ -82,6 +85,5 @@ this.rightHandNodes.push(node.typeAnnotation); | ||
* Override to use PatternVisitor we overrode. | ||
* @param {Identifier} node The Identifier node to visit. | ||
* @param {Object} [options] The flag to visit right-hand side nodes. | ||
* @param {Function} callback The callback function for left-hand side nodes. | ||
* @returns {void} | ||
* @param node The Identifier node to visit. | ||
* @param [options] The flag to visit right-hand side nodes. | ||
* @param callback The callback function for left-hand side nodes. | ||
*/ | ||
@@ -106,4 +108,3 @@ visitPattern(node, options, callback) { | ||
* Visit `node.typeParameters` and `node.returnType` additionally to find `typeof` expressions. | ||
* @param {FunctionDeclaration|FunctionExpression|ArrowFunctionExpression} node The function node to visit. | ||
* @returns {void} | ||
* @param node The function node to visit. | ||
*/ | ||
@@ -148,3 +149,3 @@ visitFunction(node) { | ||
// Process the body. | ||
if (body.type === 'BlockStatement') { | ||
if (body && body.type === 'BlockStatement') { | ||
this.visitChildren(body); | ||
@@ -161,4 +162,3 @@ } | ||
* Visit decorators. | ||
* @param {ClassDeclaration|ClassExpression} node The class node to visit. | ||
* @returns {void} | ||
* @param node The class node to visit. | ||
*/ | ||
@@ -173,3 +173,3 @@ visitClass(node) { | ||
if (node.implements) { | ||
this.visit(node.implements); | ||
node.implements.forEach(this.visit, this); | ||
} | ||
@@ -181,4 +181,3 @@ this.typeMode = upperTypeMode; | ||
* Visit typeParameters. | ||
* @param {*} node The node to visit. | ||
* @returns {void} | ||
* @param node The node to visit. | ||
*/ | ||
@@ -204,4 +203,3 @@ visitTypeParameters(node) { | ||
* Don't create the reference object in the type mode. | ||
* @param {Identifier} node The Identifier node to visit. | ||
* @returns {void} | ||
* @param node The Identifier node to visit. | ||
*/ | ||
@@ -218,4 +216,3 @@ Identifier(node) { | ||
* Visit decorators. | ||
* @param {MethodDefinition} node The MethodDefinition node to visit. | ||
* @returns {void} | ||
* @param node The MethodDefinition node to visit. | ||
*/ | ||
@@ -228,4 +225,3 @@ MethodDefinition(node) { | ||
* Don't create the reference object for the key if not computed. | ||
* @param {ClassProperty} node The ClassProperty node to visit. | ||
* @returns {void} | ||
* @param node The ClassProperty node to visit. | ||
*/ | ||
@@ -248,4 +244,3 @@ ClassProperty(node) { | ||
* Visit new expression. | ||
* @param {NewExpression} node The NewExpression node to visit. | ||
* @returns {void} | ||
* @param node The NewExpression node to visit. | ||
*/ | ||
@@ -255,5 +250,3 @@ NewExpression(node) { | ||
this.visit(node.callee); | ||
if (node.arguments) { | ||
node.arguments.forEach(this.visit, this); | ||
} | ||
node.arguments.forEach(this.visit, this); | ||
} | ||
@@ -263,4 +256,3 @@ /** | ||
* Visit call expression. | ||
* @param {CallExpression} node The CallExpression node to visit. | ||
* @returns {void} | ||
* @param node The CallExpression node to visit. | ||
*/ | ||
@@ -270,5 +262,3 @@ CallExpression(node) { | ||
this.visit(node.callee); | ||
if (node.arguments) { | ||
node.arguments.forEach(this.visit, this); | ||
} | ||
node.arguments.forEach(this.visit, this); | ||
} | ||
@@ -278,4 +268,3 @@ /** | ||
* Because to avoid confusion of `no-redeclare` rule by overloading. | ||
* @param {TSDeclareFunction} node The TSDeclareFunction node to visit. | ||
* @returns {void} | ||
* @param node The TSDeclareFunction node to visit. | ||
*/ | ||
@@ -304,4 +293,3 @@ TSDeclareFunction(node) { | ||
* Create reference objects for the references in parameters and return type. | ||
* @param {TSEmptyBodyFunctionExpression} node The TSEmptyBodyFunctionExpression node to visit. | ||
* @returns {void} | ||
* @param node The TSEmptyBodyFunctionExpression node to visit. | ||
*/ | ||
@@ -320,4 +308,3 @@ TSEmptyBodyFunctionExpression(node) { | ||
* Switch to the type mode and visit child nodes to find `typeof x` expression in type declarations. | ||
* @param {TSInterfaceDeclaration} node The TSInterfaceDeclaration node to visit. | ||
* @returns {void} | ||
* @param node The TSInterfaceDeclaration node to visit. | ||
*/ | ||
@@ -330,4 +317,3 @@ TSInterfaceDeclaration(node) { | ||
* Switch to the type mode and visit child nodes to find `typeof x` expression in type declarations. | ||
* @param {TSClassImplements} node The TSClassImplements node to visit. | ||
* @returns {void} | ||
* @param node The TSClassImplements node to visit. | ||
*/ | ||
@@ -340,4 +326,3 @@ TSClassImplements(node) { | ||
* Switch to the type mode and visit child nodes to find `typeof x` expression in type declarations. | ||
* @param {TSIndexSignature} node The TSIndexSignature node to visit. | ||
* @returns {void} | ||
* @param node The TSIndexSignature node to visit. | ||
*/ | ||
@@ -349,4 +334,3 @@ TSIndexSignature(node) { | ||
* Visit type assertion. | ||
* @param {TSTypeAssertion} node The TSTypeAssertion node to visit. | ||
* @returns {void} | ||
* @param node The TSTypeAssertion node to visit. | ||
*/ | ||
@@ -366,4 +350,3 @@ TSTypeAssertion(node) { | ||
* Visit as expression. | ||
* @param {TSAsExpression} node The TSAsExpression node to visit. | ||
* @returns {void} | ||
* @param node The TSAsExpression node to visit. | ||
*/ | ||
@@ -383,4 +366,3 @@ TSAsExpression(node) { | ||
* Switch to the type mode and visit child nodes to find `typeof x` expression in type declarations. | ||
* @param {TSTypeAnnotation} node The TSTypeAnnotation node to visit. | ||
* @returns {void} | ||
* @param node The TSTypeAnnotation node to visit. | ||
*/ | ||
@@ -392,4 +374,3 @@ TSTypeAnnotation(node) { | ||
* Switch to the type mode and visit child nodes to find `typeof x` expression in type declarations. | ||
* @param {TSTypeParameterDeclaration} node The TSTypeParameterDeclaration node to visit. | ||
* @returns {void} | ||
* @param node The TSTypeParameterDeclaration node to visit. | ||
*/ | ||
@@ -401,4 +382,3 @@ TSTypeParameterDeclaration(node) { | ||
* Create reference objects for the references in `typeof` expression. | ||
* @param {TSTypeQuery} node The TSTypeQuery node to visit. | ||
* @returns {void} | ||
* @param node The TSTypeQuery node to visit. | ||
*/ | ||
@@ -416,4 +396,3 @@ TSTypeQuery(node) { | ||
/** | ||
* @param {TSTypeParameter} node The TSTypeParameter node to visit. | ||
* @returns {void} | ||
* @param node The TSTypeParameter node to visit. | ||
*/ | ||
@@ -424,4 +403,3 @@ TSTypeParameter(node) { | ||
/** | ||
* @param {TSInferType} node The TSInferType node to visit. | ||
* @returns {void} | ||
* @param node The TSInferType node to visit. | ||
*/ | ||
@@ -432,4 +410,3 @@ TSInferType(node) { | ||
/** | ||
* @param {TSTypeReference} node The TSTypeReference node to visit. | ||
* @returns {void} | ||
* @param node The TSTypeReference node to visit. | ||
*/ | ||
@@ -440,4 +417,3 @@ TSTypeReference(node) { | ||
/** | ||
* @param {TSTypeLiteral} node The TSTypeLiteral node to visit. | ||
* @returns {void} | ||
* @param node The TSTypeLiteral node to visit. | ||
*/ | ||
@@ -448,4 +424,3 @@ TSTypeLiteral(node) { | ||
/** | ||
* @param {TSLiteralType} node The TSLiteralType node to visit. | ||
* @returns {void} | ||
* @param node The TSLiteralType node to visit. | ||
*/ | ||
@@ -456,4 +431,3 @@ TSLiteralType(node) { | ||
/** | ||
* @param {TSIntersectionType} node The TSIntersectionType node to visit. | ||
* @returns {void} | ||
* @param node The TSIntersectionType node to visit. | ||
*/ | ||
@@ -464,4 +438,3 @@ TSIntersectionType(node) { | ||
/** | ||
* @param {TSConditionalType} node The TSConditionalType node to visit. | ||
* @returns {void} | ||
* @param node The TSConditionalType node to visit. | ||
*/ | ||
@@ -472,4 +445,3 @@ TSConditionalType(node) { | ||
/** | ||
* @param {TSIndexedAccessType} node The TSIndexedAccessType node to visit. | ||
* @returns {void} | ||
* @param node The TSIndexedAccessType node to visit. | ||
*/ | ||
@@ -480,4 +452,3 @@ TSIndexedAccessType(node) { | ||
/** | ||
* @param {TSMappedType} node The TSMappedType node to visit. | ||
* @returns {void} | ||
* @param node The TSMappedType node to visit. | ||
*/ | ||
@@ -488,4 +459,3 @@ TSMappedType(node) { | ||
/** | ||
* @param {TSOptionalType} node The TSOptionalType node to visit. | ||
* @returns {void} | ||
* @param node The TSOptionalType node to visit. | ||
*/ | ||
@@ -496,4 +466,3 @@ TSOptionalType(node) { | ||
/** | ||
* @param {TSParenthesizedType} node The TSParenthesizedType node to visit. | ||
* @returns {void} | ||
* @param node The TSParenthesizedType node to visit. | ||
*/ | ||
@@ -504,4 +473,3 @@ TSParenthesizedType(node) { | ||
/** | ||
* @param {TSRestType} node The TSRestType node to visit. | ||
* @returns {void} | ||
* @param node The TSRestType node to visit. | ||
*/ | ||
@@ -512,4 +480,3 @@ TSRestType(node) { | ||
/** | ||
* @param {TSTupleType} node The TSTupleType node to visit. | ||
* @returns {void} | ||
* @param node The TSTupleType node to visit. | ||
*/ | ||
@@ -521,4 +488,3 @@ TSTupleType(node) { | ||
* Create reference objects for the object part. (This is `obj.prop`) | ||
* @param {TSQualifiedName} node The TSQualifiedName node to visit. | ||
* @returns {void} | ||
* @param node The TSQualifiedName node to visit. | ||
*/ | ||
@@ -530,4 +496,3 @@ TSQualifiedName(node) { | ||
* Create reference objects for the references in computed keys. | ||
* @param {TSPropertySignature} node The TSPropertySignature node to visit. | ||
* @returns {void} | ||
* @param node The TSPropertySignature node to visit. | ||
*/ | ||
@@ -552,4 +517,3 @@ TSPropertySignature(node) { | ||
* Create reference objects for the references in computed keys. | ||
* @param {TSMethodSignature} node The TSMethodSignature node to visit. | ||
* @returns {void} | ||
* @param node The TSMethodSignature node to visit. | ||
*/ | ||
@@ -588,4 +552,3 @@ TSMethodSignature(node) { | ||
* | ||
* @param {TSEnumDeclaration} node The TSEnumDeclaration node to visit. | ||
* @returns {void} | ||
* @param node The TSEnumDeclaration node to visit. | ||
*/ | ||
@@ -609,4 +572,3 @@ TSEnumDeclaration(node) { | ||
* | ||
* @param {TSEnumMember} node The TSEnumMember node to visit. | ||
* @returns {void} | ||
* @param node The TSEnumMember node to visit. | ||
*/ | ||
@@ -624,4 +586,3 @@ TSEnumMember(node) { | ||
* Create the variable object for the module name, and visit children. | ||
* @param {TSModuleDeclaration} node The TSModuleDeclaration node to visit. | ||
* @returns {void} | ||
* @param node The TSModuleDeclaration node to visit. | ||
*/ | ||
@@ -647,4 +608,3 @@ TSModuleDeclaration(node) { | ||
* Process the module block. | ||
* @param {TSModuleBlock} node The TSModuleBlock node to visit. | ||
* @returns {void} | ||
* @param node The TSModuleBlock node to visit. | ||
*/ | ||
@@ -664,4 +624,3 @@ TSModuleBlock(node) { | ||
* Process import equal declaration | ||
* @param {TSImportEqualsDeclaration} node The TSImportEqualsDeclaration node to visit. | ||
* @returns {void} | ||
* @param node The TSImportEqualsDeclaration node to visit. | ||
*/ | ||
@@ -679,4 +638,3 @@ TSImportEqualsDeclaration(node) { | ||
* 2. Configure the global scope to set `variable.eslintUsed = true` for all defined variables. This means `no-unused-vars` doesn't warn those. | ||
* @param {TSModuleDeclaration} node The TSModuleDeclaration node to visit. | ||
* @returns {void} | ||
* @param node The TSModuleDeclaration node to visit. | ||
*/ | ||
@@ -691,4 +649,4 @@ visitGlobalAugmentation(node) { | ||
// Skip TSModuleBlock to avoid to create that block scope. | ||
for (const moduleItem of node.body.body) { | ||
this.visit(moduleItem); | ||
if (node.body && node.body.type === 'TSModuleBlock') { | ||
node.body.body.forEach(this.visit, this); | ||
} | ||
@@ -700,4 +658,3 @@ scopeManager.__currentScope = currentScope; | ||
* Process decorators. | ||
* @param {Decorator[]|undefined} decorators The decorator nodes to visit. | ||
* @returns {void} | ||
* @param decorators The decorator nodes to visit. | ||
*/ | ||
@@ -711,4 +668,3 @@ visitDecorators(decorators) { | ||
* Process all child of type nodes | ||
* @param {any} node node to be processed | ||
* @returns {void} | ||
* @param node node to be processed | ||
*/ | ||
@@ -715,0 +671,0 @@ visitTypeNodes(node) { |
@@ -1,11 +0,5 @@ | ||
import { AST_NODE_TYPES } from '@typescript-eslint/typescript-estree'; | ||
import { AST_NODE_TYPES, ParserServices } from '@typescript-eslint/typescript-estree'; | ||
import { analyzeScope } from './analyze-scope'; | ||
import { ParserOptions } from './parser-options'; | ||
import { visitorKeys } from './visitor-keys'; | ||
import { Program } from 'typescript'; | ||
interface ParserServices { | ||
program: Program | undefined; | ||
esTreeNodeToTSNodeMap: WeakMap<object, any> | undefined; | ||
tsNodeToESTreeNodeMap: WeakMap<object, any> | undefined; | ||
} | ||
interface ParseForESLintResult { | ||
@@ -12,0 +6,0 @@ ast: any; |
{ | ||
"name": "@typescript-eslint/parser", | ||
"version": "1.2.1-alpha.16+3306198", | ||
"version": "1.2.1-alpha.18+07e950e", | ||
"description": "An ESLint custom parser which leverages TypeScript ESTree", | ||
@@ -39,3 +39,3 @@ "main": "dist/parser.js", | ||
"dependencies": { | ||
"@typescript-eslint/typescript-estree": "1.2.1-alpha.16+3306198", | ||
"@typescript-eslint/typescript-estree": "1.2.1-alpha.18+07e950e", | ||
"eslint-scope": "^4.0.0", | ||
@@ -47,6 +47,5 @@ "eslint-visitor-keys": "^1.0.0" | ||
"@types/eslint-visitor-keys": "^1.0.0", | ||
"@types/estree": "^0.0.39", | ||
"@typescript-eslint/shared-fixtures": "1.2.1-alpha.16+3306198" | ||
"@typescript-eslint/shared-fixtures": "1.2.1-alpha.18+07e950e" | ||
}, | ||
"gitHead": "33061987c0cfd235014134dfd75e28c3eb4cfc2a" | ||
"gitHead": "07e950eb877746ae34a7ce2f0afe4805178cbc43" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
3
41133
896