├── .npmrc ├── .prettierignore ├── tests ├── fixtures │ ├── jsx │ │ ├── self-closing-tag.src.js │ │ ├── empty-placeholder.src.js │ │ ├── invalid-attribute.src.js │ │ ├── invalid-no-tag-name.src.js │ │ ├── invalid-broken-tag.src.js │ │ ├── invalid-missing-closing-tag.src.js │ │ ├── japanese-characters.src.js │ │ ├── less-than-operator.src.js │ │ ├── shorthand-fragment.src.js │ │ ├── tag-names-with-dots.src.js │ │ ├── invalid-missing-namespace-name.src.js │ │ ├── member-expression.src.js │ │ ├── multiple-blank-spaces.src.js │ │ ├── self-closing-tag-with-newline.src.js │ │ ├── spread-child.src.js │ │ ├── test-content.src.js │ │ ├── invalid-leading-dot-tag-name.src.js │ │ ├── invalid-mismatched-closing-tag.src.js │ │ ├── invalid-mismatched-closing-tags.src.js │ │ ├── invalid-mismatched-namespace-tag.src.js │ │ ├── invalid-missing-namespace-value.src.js │ │ ├── invalid-trailing-dot-tag-name.src.js │ │ ├── namespaced-name-and-attribute.src.js │ │ ├── tag-names-with-multi-dots.src.js │ │ ├── invalid-computed-end-tag-name.src.js │ │ ├── invalid-embedded-expression.src.js │ │ ├── invalid-mismatched-dot-tag-name.src.js │ │ ├── invalid-missing-spread-operator.src.js │ │ ├── shorthand-fragment-with-child.src.js │ │ ├── spread-operator-attributes.src.js │ │ ├── unknown-escape-pattern.src.js │ │ ├── embedded-comment.src.js │ │ ├── embedded-conditional.src.js │ │ ├── invalid-namespace-name-with-docts.src.js │ │ ├── invalid-namespace-value-with-dots.src.js │ │ ├── attributes.src.js │ │ ├── invalid-attribute-missing-equals.src.js │ │ ├── invalid-shorthand-fragment-no-closing.src.js │ │ ├── invalid-unexpected-comma.src.js │ │ ├── invalid-computed-string-end-tag-name.src.js │ │ ├── invalid-missing-closing-tag-attribute-placeholder.src.js │ │ ├── invalid-no-common-parent.src.js │ │ ├── invalid-placeholder-in-closing-tag.src.js │ │ ├── self-closing-tag-inside-tag.src.js │ │ ├── embedded-invalid-js-identifier.src.js │ │ ├── embedded-tags.src.js │ │ ├── member-expression-this.src.js │ │ ├── namespaced-attribute-and-value-inserted.src.js │ │ ├── newslines-and-entities.src.js │ │ ├── invalid-matching-placeholder-in-closing-tag.src.js │ │ ├── spread-operator-attribute-and-regular-attribute.src.js │ │ ├── trailing-spread-operator-attribute.src.js │ │ ├── element-keyword-name.src.js │ │ ├── escape-patterns.src.js │ │ └── invalid-no-common-parent-with-comment.src.js │ ├── semanticInfo │ │ ├── badTSConfig │ │ │ ├── app.ts │ │ │ └── tsconfig.json │ │ ├── isolated-file.src.ts │ │ ├── export-file.src.ts │ │ ├── extra-file-extension.vue │ │ ├── import-file.src.ts │ │ └── tsconfig.json │ ├── javascript │ │ ├── bigIntLiterals │ │ │ ├── decimal.src.js │ │ │ ├── hex.src.js │ │ │ ├── octal.src.js │ │ │ └── binary.src.js │ │ ├── classes │ │ │ ├── empty-class.src.js │ │ │ ├── class-expression.src.js │ │ │ ├── empty-class-semi.src.js │ │ │ ├── empty-class-double-semi.src.js │ │ │ ├── named-class-expression.src.js │ │ │ ├── class-two-methods.src.js │ │ │ ├── invalid-class-declaration.src.js │ │ │ ├── class-method-named-static.src.js │ │ │ ├── class-one-method.src.js │ │ │ ├── class-static-method.src.js │ │ │ ├── class-two-methods-semi.src.js │ │ │ ├── derived-class-expression.src.js │ │ │ ├── class-method-named-prototype.src.js │ │ │ ├── class-two-methods-three-semi.src.js │ │ │ ├── class-two-methods-two-semi.src.js │ │ │ ├── class-with-constructor.src.js │ │ │ ├── empty-literal-derived-class.src.js │ │ │ ├── named-derived-class-expression.src.js │ │ │ ├── class-accessor-properties.src.js │ │ │ ├── class-computed-static-method.src.js │ │ │ ├── derived-class-assign-to-var.src.js │ │ │ ├── invalid-class-two-super-classes.src.js │ │ │ ├── class-method-named-with-space.src.js │ │ │ ├── class-static-method-named-static.src.js │ │ │ ├── invalid-class-setter-declaration.src.js │ │ │ ├── class-with-constructor-with-space.src.js │ │ │ ├── class-static-method-named-prototype.src.js │ │ │ ├── class-two-computed-static-methods.src.js │ │ │ ├── class-with-constructor-parameters.src.js │ │ │ ├── class-one-method-super.src.js │ │ │ ├── class-two-methods-computed-constructor.src.js │ │ │ ├── class-two-static-methods-named-constructor.src.js │ │ │ └── class-static-methods-and-accessor-properties.src.js │ │ ├── for │ │ │ ├── for-empty.src.js │ │ │ ├── for-loop.src.js │ │ │ ├── for-with-const.src.js │ │ │ ├── for-with-let.src.js │ │ │ ├── for-with-function.src.js │ │ │ └── for-with-coma.src.js │ │ ├── arrowFunctions │ │ │ ├── basic.src.js │ │ │ ├── expression.src.js │ │ │ ├── as-param.src.js │ │ │ ├── block-body.src.js │ │ │ ├── single-param.src.js │ │ │ ├── error-dup-params.src.js │ │ │ ├── error-reverse-arrow.src.js │ │ │ ├── iife.src.js │ │ │ ├── not-strict-eval.src.js │ │ │ ├── not-strict-octal.src.js │ │ │ ├── error-missing-paren.src.js │ │ │ ├── error-numeric-param.src.js │ │ │ ├── error-wrapped-param.src.js │ │ │ ├── multiple-params.src.js │ │ │ ├── no-auto-return.src.js │ │ │ ├── return-arrow-function.src.js │ │ │ ├── single-param-parens.src.js │ │ │ ├── as-param-with-params.src.js │ │ │ ├── block-body-not-object.src.js │ │ │ ├── error-two-lines.src.js │ │ │ ├── not-strict-arguments.src.js │ │ │ ├── not-strict-eval-params.src.js │ │ │ ├── error-not-arrow.src.js │ │ │ ├── error-numeric-param-multi.src.js │ │ │ ├── error-strict-octal.src.js │ │ │ ├── return-sequence.src.js │ │ │ ├── single-param-return-identifier.src.js │ │ │ ├── error-strict-dup-params.src.js │ │ │ ├── error-strict-eval-return.src.js │ │ │ ├── error-strict-eval.src.js │ │ │ ├── error-strict-param-eval.src.js │ │ │ ├── error-strict-param-names.src.js │ │ │ ├── error-strict-param-no-paren-eval.src.js │ │ │ ├── error-strict-default-param-eval.src.js │ │ │ ├── error-strict-param-arguments.src.js │ │ │ ├── basic-in-binary-expression.src.js │ │ │ └── error-strict-param-no-paren-arguments.src.js │ │ ├── basics │ │ │ ├── instanceof.src.js │ │ │ ├── delete-expression.src.js │ │ │ ├── typeof-expression.src.js │ │ │ ├── void-expression.src.js │ │ │ ├── new-with-member-expression.src.js │ │ │ ├── new-without-parens.src.js │ │ │ ├── update-expression.src.js │ │ │ ├── do-while-statements.src.js │ │ │ ├── identifiers-double-underscore.src.js │ │ │ ├── and-operator-array-object.src.js │ │ │ └── or-operator-array-object.src.js │ │ ├── binaryLiterals │ │ │ ├── invalid.src.js │ │ │ ├── lowercase.src.js │ │ │ └── uppercase.src.js │ │ ├── directives │ │ │ ├── raw.src.js │ │ │ ├── program-order.src.js │ │ │ ├── program.src.js │ │ │ ├── function-non-strict.src.js │ │ │ ├── block.src.js │ │ │ ├── non-directive-string.src.js │ │ │ └── directive-in-class.src.js │ │ ├── octalLiterals │ │ │ ├── invalid.src.js │ │ │ ├── lowercase.src.js │ │ │ ├── uppercase.src.js │ │ │ └── strict-uppercase.src.js │ │ ├── blockBindings │ │ │ ├── const.src.js │ │ │ ├── let.src.js │ │ │ └── let-in-switchcase.src.js │ │ ├── destructuring │ │ │ ├── array-member.src.js │ │ │ ├── defaults-array.src.js │ │ │ ├── array-to-array.src.js │ │ │ ├── defaults-object.src.js │ │ │ ├── object-var-named.src.js │ │ │ ├── sparse-array.src.js │ │ │ ├── array-var-undefined.src.js │ │ │ ├── object-var-undefined.src.js │ │ │ ├── params-array.src.js │ │ │ ├── params-object.src.js │ │ │ ├── defaults-array-multi.src.js │ │ │ ├── defaults-object-longform.src.js │ │ │ ├── defaults-object-multi.src.js │ │ │ ├── named-param.src.js │ │ │ ├── nested-array.src.js │ │ │ ├── param-defaults-array.src.js │ │ │ ├── param-defaults-object.src.js │ │ │ ├── params-array-wrapped.src.js │ │ │ ├── params-object-wrapped.src.js │ │ │ ├── call-expression-destruction-array.src.js │ │ │ ├── call-expression-destruction-object.src.js │ │ │ ├── defaults-array-all.src.js │ │ │ ├── defaults-array-nested-multi.src.js │ │ │ ├── defaults-object-all.src.js │ │ │ ├── params-multi-object.src.js │ │ │ ├── params-nested-array.src.js │ │ │ ├── defaults-array-nested-all.src.js │ │ │ ├── defaults-object-assign.src.js │ │ │ ├── defaults-object-mixed-multi.src.js │ │ │ ├── defaults-object-nested-multi.src.js │ │ │ ├── params-nested-object.src.js │ │ │ ├── defaults-object-nested-all.src.js │ │ │ ├── defaults-object-longform-multi.src.js │ │ │ ├── invalid-defaults-object-assign.src.js │ │ │ ├── nested-object.src.js │ │ │ ├── defaults-object-longform-all.src.js │ │ │ ├── param-defaults-object-nested.src.js │ │ │ ├── defaults-array-longform-nested-multi.src.js │ │ │ ├── class-method-params-array.src.js │ │ │ ├── class-method-params-object.src.js │ │ │ ├── class-constructor-params-array.src.js │ │ │ ├── class-constructor-params-object.src.js │ │ │ ├── class-method-params-defaults-array.src.js │ │ │ ├── class-method-params-defaults-object.src.js │ │ │ ├── class-constructor-params-defaults-array.src.js │ │ │ ├── class-constructor-params-defaults-object.src.js │ │ │ ├── destructured-array-catch.src.js │ │ │ └── destructured-object-catch.src.js │ │ ├── forIn │ │ │ ├── for-in-array.src.js │ │ │ ├── for-in-object.src.js │ │ │ ├── for-in-object-with-body.src.js │ │ │ ├── for-in-with-bare-assigment.src.js │ │ │ ├── for-in-with-var.src.js │ │ │ ├── for-in-destruction.src.js │ │ │ ├── for-in-with-const.src.js │ │ │ ├── for-in-with-milti-asigment.src.js │ │ │ ├── for-in-destruction-object.src.js │ │ │ ├── for-in-with-assigment.src.js │ │ │ ├── for-in-with-rest.src.js │ │ │ └── for-in-bare-nonstrict.src.js │ │ ├── globalReturn │ │ │ ├── return-no-arg.src.js │ │ │ ├── return-true.src.js │ │ │ └── return-identifier.src.js │ │ ├── modules │ │ │ ├── export-var.src.js │ │ │ ├── import-module.src.js │ │ │ ├── export-named-empty.src.js │ │ │ ├── invalid-await.src.js │ │ │ ├── export-from-batch.src.js │ │ │ ├── export-named-specifier.src.js │ │ │ ├── export-var-number.src.js │ │ │ ├── import-default.src.js │ │ │ ├── import-jquery.src.js │ │ │ ├── invalid-class.src.js │ │ │ ├── invalid-export-batch-token.src.js │ │ │ ├── export-default-array.src.js │ │ │ ├── export-default-number.src.js │ │ │ ├── export-default-value.src.js │ │ │ ├── export-function.src.js │ │ │ ├── export-named-specifiers.src.js │ │ │ ├── import-named-empty.src.js │ │ │ ├── error-delete.src.js │ │ │ ├── export-default-object.src.js │ │ │ ├── export-from-default.src.js │ │ │ ├── export-from-specifier.src.js │ │ │ ├── export-named-as-default.src.js │ │ │ ├── export-named-as-specifier.src.js │ │ │ ├── import-named-specifier.src.js │ │ │ ├── invalid-export-default-equal.src.js │ │ │ ├── invalid-export-default-token.src.js │ │ │ ├── invalid-export-default.src.js │ │ │ ├── invalid-export-named-default.src.js │ │ │ ├── invalid-import-default.src.js │ │ │ ├── export-default-expression.src.js │ │ │ ├── export-default-function.src.js │ │ │ ├── export-from-specifiers.src.js │ │ │ ├── export-named-class.src.js │ │ │ ├── export-named-specifiers-comma.src.js │ │ │ ├── import-default-as.src.js │ │ │ ├── import-named-specifiers.src.js │ │ │ ├── import-null-as-nil.src.js │ │ │ ├── invalid-export-batch-missing-from-clause.src.js │ │ │ ├── invalid-export-named-extra-comma.src.js │ │ │ ├── invalid-export-named-middle-comma.src.js │ │ │ ├── invalid-import-module-specifier.src.js │ │ │ ├── export-default-class.src.js │ │ │ ├── export-named-as-specifiers.src.js │ │ │ ├── import-named-as-specifier.src.js │ │ │ ├── import-namespace-specifier.src.js │ │ │ ├── invalid-import-default-missing-module-specifier.src.js │ │ │ ├── invalid-import-namespace-missing-as.src.js │ │ │ ├── export-default-named-function.src.js │ │ │ ├── export-from-named-as-specifier.src.js │ │ │ ├── export-var-anonymous-function.src.js │ │ │ ├── import-named-as-specifiers.src.js │ │ │ ├── import-named-specifiers-comma.src.js │ │ │ ├── invalid-import-default-after-named.src.js │ │ │ ├── invalid-import-default-module-specifier.src.js │ │ │ ├── invalid-import-missing-module-specifier.src.js │ │ │ ├── invalid-import-named-as-missing-from.src.js │ │ │ ├── export-default-named-class.src.js │ │ │ ├── export-from-named-as-default.src.js │ │ │ ├── import-default-and-named-specifiers.src.js │ │ │ ├── invalid-import-named-after-named.src.js │ │ │ ├── invalid-import-named-extra-comma.src.js │ │ │ ├── invalid-import-named-middle-comma.src.js │ │ │ ├── error-function.src.js │ │ │ ├── export-from-named-as-specifiers.src.js │ │ │ ├── import-default-and-namespace-specifiers.src.js │ │ │ ├── invalid-import-named-after-namespace.src.js │ │ │ ├── invalid-import-namespace-after-named.src.js │ │ │ ├── invalid-import-default-after-named-after-default.src.js │ │ │ └── error-strict.src.js │ │ ├── spread │ │ │ ├── error-invalid-if.src.js │ │ │ ├── error-invalid-sequence.src.js │ │ │ ├── multi-function-call.src.js │ │ │ ├── not-final-param.src.js │ │ │ ├── simple-function-call.src.js │ │ │ └── complex-spread.src.js │ │ ├── defaultParams │ │ │ ├── declaration.src.js │ │ │ ├── expression.src.js │ │ │ ├── method.src.js │ │ │ ├── not-all-params.src.js │ │ │ ├── class-method.src.js │ │ │ └── class-constructor.src.js │ │ ├── regex │ │ │ └── regexp-simple.src.js │ │ ├── restParams │ │ │ ├── basic-rest.src.js │ │ │ ├── single-rest.src.js │ │ │ ├── error-not-last.src.js │ │ │ ├── error-no-default.src.js │ │ │ ├── func-expression.src.js │ │ │ ├── invalid-rest-param.src.js │ │ │ ├── func-expression-multi.src.js │ │ │ ├── class-method.src.js │ │ │ └── class-constructor.src.js │ │ ├── templateStrings │ │ │ ├── simple-template-string.src.js │ │ │ ├── error-octal-literal.src.js │ │ │ ├── single-dollar-sign.src.js │ │ │ ├── tagged-no-placeholders.src.js │ │ │ ├── escape-characters.src.js │ │ │ ├── deeply-nested.src.js │ │ │ ├── expressions.src.js │ │ │ ├── tagged-template-string.src.js │ │ │ └── multi-line-template-string.src.js │ │ ├── destructuring-and-forOf │ │ │ └── loop.src.js │ │ ├── importMeta │ │ │ └── simple-import-meta.src.js │ │ ├── regexUFlag │ │ │ ├── regex-u-simple.src.js │ │ │ ├── regex-u-invalid-extended-escape.src.js │ │ │ └── regex-u-extended-escape.src.js │ │ ├── regexYFlag │ │ │ └── regexp-y-simple.src.js │ │ ├── simple-literals │ │ │ ├── literal-float.src.js │ │ │ ├── literal-null.src.js │ │ │ ├── literal-number.src.js │ │ │ ├── literal-string.src.js │ │ │ ├── literal-float-negative.src.js │ │ │ ├── literal-number-negative.src.js │ │ │ └── literal-undefined.src.js │ │ ├── arrayLiteral │ │ │ ├── array-literal-in-lhs.src.js │ │ │ └── array-literals-in-binary-expr.src.js │ │ ├── callExpression │ │ │ ├── call-expression-with-array.src.js │ │ │ ├── call-expression-with-object.src.js │ │ │ ├── new-expression-with-object.src.js │ │ │ ├── new-expression-with-array.src.js │ │ │ └── mixed-expression.src.js │ │ ├── destructuring-and-spread │ │ │ ├── not-final-array.src.js │ │ │ ├── single-destructured.src.js │ │ │ ├── multi-destructured.src.js │ │ │ ├── var-multi-destructured.src.js │ │ │ ├── var-single-destructured.src.js │ │ │ ├── complex-destructured.src.js │ │ │ ├── invalid-not-final-array-empty.src.js │ │ │ ├── destructured-array-literal.src.js │ │ │ ├── destructuring-param.src.js │ │ │ ├── var-complex-destructured.src.js │ │ │ ├── var-destructured-array-literal.src.js │ │ │ └── error-complex-destructured-spread-first.src.js │ │ ├── generators │ │ │ ├── empty-generator-declaration.src.js │ │ │ ├── yield-delegation.src.js │ │ │ ├── anonymous-generator.src.js │ │ │ ├── double-yield.src.js │ │ │ ├── generator-declaration.src.js │ │ │ ├── yield-without-value.src.js │ │ │ ├── yield-without-value-no-semi.src.js │ │ │ ├── yield-without-value-in-call.src.js │ │ │ ├── async-generator-function.src.js │ │ │ └── async-generator-method.src.js │ │ ├── newTarget │ │ │ ├── invalid-new-target.src.js │ │ │ ├── simple-new-target.src.js │ │ │ └── invalid-unknown-property.src.js │ │ ├── objectLiteral │ │ │ └── object-literal-in-lhs.src.js │ │ ├── unicodeCodePointEscapes │ │ │ ├── invalid-empty-escape.src.js │ │ │ ├── basic-string-literal.src.js │ │ │ ├── invalid-too-large-escape.src.js │ │ │ └── complex-string-literal.src.js │ │ ├── destructuring-and-arrowFunctions │ │ │ ├── arrow-param-array.src.js │ │ │ ├── arrow-param-object.src.js │ │ │ ├── param-defaults-array.src.js │ │ │ ├── param-defaults-object.src.js │ │ │ ├── arrow-param-nested-array.src.js │ │ │ ├── arrow-param-nested-object.src.js │ │ │ ├── arrow-param-nested-object-named.src.js │ │ │ └── param-defaults-object-nested.src.js │ │ ├── destructuring-and-blockBindings │ │ │ ├── array-let-undefined.src.js │ │ │ ├── object-let-named.src.js │ │ │ ├── object-let-undefined.src.js │ │ │ ├── array-const-undefined.src.js │ │ │ ├── object-const-named.src.js │ │ │ └── object-const-undefined.src.js │ │ ├── forOf │ │ │ ├── for-of-array.src.js │ │ │ ├── for-of-destruction.src.js │ │ │ ├── for-of-object.src.js │ │ │ ├── for-of-destruction-object.src.js │ │ │ ├── for-of-with-rest.src.js │ │ │ ├── for-of-with-var-and-no-braces.src.js │ │ │ ├── for-of-with-var-and-braces.src.js │ │ │ ├── invalid-for-of-with-let-and-no-braces.src.js │ │ │ ├── invalid-for-of-with-const-and-no-braces.src.js │ │ │ └── for-of-with-function-initializer.src.js │ │ ├── destructuring-and-defaultParams │ │ │ ├── param-array.src.js │ │ │ ├── param-object-short.src.js │ │ │ ├── param-object.src.js │ │ │ └── param-object-wrapped.src.js │ │ ├── experimentalDynamicImport │ │ │ └── dynamic-import.src.js │ │ ├── experimentalObjectRestSpread │ │ │ ├── arg-spread.src.js │ │ │ ├── spread-trailing-comma.src.js │ │ │ ├── destructuring-assign-mirror.src.js │ │ │ ├── invalid-rest-trailing-comma.src.js │ │ │ ├── function-parameter-object-spread.src.js │ │ │ ├── object-rest.src.js │ │ │ ├── invalid-rest.src.js │ │ │ ├── shorthand-properties.src.js │ │ │ ├── two-spread.src.js │ │ │ ├── single-spread.src.js │ │ │ ├── property-spread.src.js │ │ │ ├── shorthand-method-args.src.js │ │ │ └── shorthand-methods.src.js │ │ ├── objectLiteralComputedProperties │ │ │ ├── standalone-expression.src.js │ │ │ ├── computed-and-identifier.src.js │ │ │ ├── computed-getter-and-setter.src.js │ │ │ ├── invalid-standalone-computed-variable-property.src.js │ │ │ ├── standalone-expression-with-addition.src.js │ │ │ ├── standalone-expression-with-method.src.js │ │ │ ├── computed-addition-property.src.js │ │ │ ├── computed-string-property.src.js │ │ │ ├── computed-variable-property.src.js │ │ │ └── invalid-computed-variable-property.src.js │ │ ├── experimentalOptionalCatchBinding │ │ │ ├── optional-catch-binding.src.js │ │ │ └── optional-catch-binding-finally.src.js │ │ ├── exponentiationOperators │ │ │ └── exponential-operators.src.js │ │ ├── experimentalAsyncIteration │ │ │ ├── async-generators.src.js │ │ │ └── async-iterator.src.js │ │ ├── objectLiteralShorthandMethods │ │ │ ├── simple-method.src.js │ │ │ ├── invalid-method-no-braces.src.js │ │ │ ├── simple-method-named-get.src.js │ │ │ ├── simple-method-named-set.src.js │ │ │ ├── simple-method-with-string-name.src.js │ │ │ ├── simple-method-with-argument.src.js │ │ │ ├── method-property.src.js │ │ │ └── string-name-method-property.src.js │ │ ├── labels │ │ │ ├── label-break.src.js │ │ │ └── label-continue.src.js │ │ ├── objectLiteralDuplicateProperties │ │ │ ├── strict-duplicate-properties.src.js │ │ │ ├── strict-duplicate-string-properties.src.js │ │ │ ├── error-proto-property.src.js │ │ │ └── error-proto-string-property.src.js │ │ └── objectLiteralShorthandProperties │ │ │ └── shorthand-properties.src.js │ ├── typescript │ │ ├── errorRecovery │ │ │ ├── solo-const.src.ts │ │ │ ├── empty-type-arguments.src.ts │ │ │ ├── decorator-on-enum-declaration.src.ts │ │ │ ├── class-empty-extends.src.ts │ │ │ ├── interface-implements.src.ts │ │ │ ├── decorator-on-interface-declaration.src.ts │ │ │ ├── class-multiple-implements.src.ts │ │ │ ├── interface-empty-extends.src.ts │ │ │ ├── interface-multiple-extends.src.ts │ │ │ ├── class-empty-extends-implements.src.ts │ │ │ ├── class-extends-empty-implements.src.ts │ │ │ ├── interface-property-export.src.ts │ │ │ ├── interface-property-static.src.ts │ │ │ ├── interface-property-private.src.ts │ │ │ ├── interface-property-protected.src.ts │ │ │ ├── interface-property-public.src.ts │ │ │ ├── enum-with-keywords.src.ts │ │ │ ├── index-signature-parameters.src.ts │ │ │ ├── interface-method-export.src.ts │ │ │ ├── interface-method-public.src.ts │ │ │ ├── interface-method-static.src.ts │ │ │ ├── interface-property-with-default-value.src.ts │ │ │ ├── interface-method-private.src.ts │ │ │ ├── interface-method-protected.src.ts │ │ │ ├── interface-index-signature-export.src.ts │ │ │ ├── interface-index-signature-private.src.ts │ │ │ ├── interface-index-signature-public.src.ts │ │ │ ├── interface-index-signature-static.src.ts │ │ │ └── interface-index-signature-protected.src.ts │ │ ├── types │ │ │ ├── indexed.src.ts │ │ │ ├── reference.src.ts │ │ │ ├── literal-number.src.ts │ │ │ ├── tuple-empty.src.ts │ │ │ ├── typeof.src.ts │ │ │ ├── array-type.src.ts │ │ │ ├── literal-string.src.ts │ │ │ ├── literal-number-negative.src.ts │ │ │ ├── function-generic.src.ts │ │ │ ├── reference-generic.src.ts │ │ │ ├── tuple-rest.src.ts │ │ │ ├── tuple-type.src.ts │ │ │ ├── tuple.src.ts │ │ │ ├── type-literal.src.ts │ │ │ ├── union-type.src.ts │ │ │ ├── function-in-generic.src.ts │ │ │ ├── mapped.src.ts │ │ │ ├── constructor-generic.src.ts │ │ │ ├── function-with-this.src.ts │ │ │ ├── function.src.ts │ │ │ ├── parenthesized-type.src.ts │ │ │ ├── constructor-in-generic.src.ts │ │ │ ├── constructor.src.ts │ │ │ ├── function-with-rest.src.ts │ │ │ ├── reference-generic-nested.src.ts │ │ │ ├── type-operator.src.ts │ │ │ ├── conditional.src.ts │ │ │ ├── constructor-with-rest.src.ts │ │ │ ├── tuple-optional.src.ts │ │ │ ├── index-signature.src.ts │ │ │ ├── mapped-readonly.src.ts │ │ │ ├── conditional-infer.src.ts │ │ │ ├── conditional-with-null.src.ts │ │ │ ├── index-signature-without-type.src.ts │ │ │ ├── intersection-type.src.ts │ │ │ ├── mapped-readonly-minus.src.ts │ │ │ ├── mapped-readonly-plus.src.ts │ │ │ ├── index-signature-readonly.src.ts │ │ │ ├── this-type.src.ts │ │ │ ├── conditional-infer-simple.src.ts │ │ │ ├── nested-types.src.ts │ │ │ ├── conditional-infer-nested.src.ts │ │ │ ├── union-intersection.src.ts │ │ │ └── this-type-expanded.src.ts │ │ ├── basics │ │ │ ├── cast-as-multi.src.ts │ │ │ ├── export-assignment.src.ts │ │ │ ├── keyof-operator.src.ts │ │ │ ├── typed-keyword-null.src.ts │ │ │ ├── typed-keyword-true.src.ts │ │ │ ├── typed-keyword-void.src.ts │ │ │ ├── cast-as-expression.src.ts │ │ │ ├── cast-as-operator.src.ts │ │ │ ├── cast-as-simple.src.ts │ │ │ ├── typed-keyword-bigint.src.ts │ │ │ ├── typed-keyword-false.src.ts │ │ │ ├── typed-keyword-never.src.ts │ │ │ ├── typed-keyword-number.src.ts │ │ │ ├── typed-keyword-object.src.ts │ │ │ ├── typed-keyword-string.src.ts │ │ │ ├── typed-keyword-symbol.src.ts │ │ │ ├── unique-symbol.src.ts │ │ │ ├── var-with-dotted-type.src.ts │ │ │ ├── destructuring-assignment.src.ts │ │ │ ├── export-as-namespace.src.ts │ │ │ ├── type-assertion.src.ts │ │ │ ├── typed-keyword-boolean.src.ts │ │ │ ├── typed-keyword-undefined.src.ts │ │ │ ├── typed-keyword-unknown.src.ts │ │ │ ├── unknown-type-annotation.src.ts │ │ │ ├── abstract-interface.src.ts │ │ │ ├── cast-as-multi-assign.src.ts │ │ │ ├── interface-with-generic.src.ts │ │ │ ├── class-with-type-parameter-underscore.src.ts │ │ │ ├── class-with-type-parameter.src.ts │ │ │ ├── declare-function.src.ts │ │ │ ├── destructuring-assignment-object.src.ts │ │ │ ├── import-equal-declaration.src.ts │ │ │ ├── async-function-expression.src.ts │ │ │ ├── class-multi-line-keyword-abstract.src.ts │ │ │ ├── class-multi-line-keyword-declare.src.ts │ │ │ ├── class-with-implements.src.ts │ │ │ ├── const-enum.src.ts │ │ │ ├── interface-extends.src.ts │ │ │ ├── interface-type-parameters.src.ts │ │ │ ├── symbol-type-param.src.ts │ │ │ ├── type-alias-declaration.src.ts │ │ │ ├── class-with-definite-assignment.src.ts │ │ │ ├── class-with-generic-method.src.ts │ │ │ ├── export-named-class-with-generic.src.ts │ │ │ ├── nested-type-arguments.src.ts │ │ │ ├── variable-declaration-type-annotation-spacing.src.ts │ │ │ ├── class-with-extends-generic.src.ts │ │ │ ├── class-with-type-parameter-default.src.ts │ │ │ ├── export-named-enum.src.ts │ │ │ ├── export-type-alias-declaration.src.ts │ │ │ ├── import-export-equal-declaration.src.ts │ │ │ ├── interface-extends-multiple.src.ts │ │ │ ├── interface-without-type-annotation.src.ts │ │ │ ├── never-type-param.src.ts │ │ │ ├── null-and-undefined-type-annotations.src.ts │ │ │ ├── type-alias-object-without-annotation.src.ts │ │ │ ├── arrow-function-with-type-parameters.src.ts │ │ │ ├── class-with-implements-generic.src.ts │ │ │ ├── export-default-class-with-generic.src.ts │ │ │ ├── import-type.src.ts │ │ │ ├── type-assertion-arrow-function.src.ts │ │ │ ├── var-with-type.src.ts │ │ │ ├── class-with-generic-method-default.src.ts │ │ │ ├── declare-class-with-optional-method.src.ts │ │ │ ├── destructuring-assignment-property.src.ts │ │ │ ├── export-named-class-with-multiple-generics.src.ts │ │ │ ├── export-type-function-declaration.src.ts │ │ │ ├── function-with-await.src.ts │ │ │ ├── function-with-type-parameters-that-have-comments.src.ts │ │ │ ├── function-with-type-parameters.src.ts │ │ │ ├── interface-with-extends-member-expression.src.ts │ │ │ ├── class-with-implements-generic-multiple.src.ts │ │ │ ├── class-with-mixin-reference.src.ts │ │ │ ├── export-default-class-with-multiple-generics.src.ts │ │ │ ├── export-type-class-declaration.src.ts │ │ │ ├── import-type-with-type-parameters-in-type-reference.src.ts │ │ │ ├── interface-with-extends-type-parameters.src.ts │ │ │ ├── parenthesized-use-strict.src.ts │ │ │ ├── call-signatures.src.ts │ │ │ ├── class-with-extends-generic-multiple.src.ts │ │ │ ├── class-with-readonly-property.src.ts │ │ │ ├── export-declare-named-enum.src.ts │ │ │ ├── function-with-types.src.ts │ │ │ ├── type-guard-in-interface.src.ts │ │ │ ├── var-with-definite-assignment.src.ts │ │ │ ├── class-with-method.src.ts │ │ │ ├── class-with-optional-computed-property.src.ts │ │ │ ├── class-with-optional-property-undefined.src.ts │ │ │ ├── typed-method-signature.src.ts │ │ │ ├── directive-in-module.src.ts │ │ │ ├── export-declare-const-named-enum.src.ts │ │ │ ├── interface-with-method.src.ts │ │ │ ├── type-alias-declaration-with-constrained-type-parameter.src.ts │ │ │ ├── directive-in-namespace.src.ts │ │ │ ├── function-with-object-type-without-annotation.src.ts │ │ │ ├── type-guard-in-function.src.ts │ │ │ ├── call-signatures-with-generics.src.ts │ │ │ ├── function-with-type-parameters-with-constraint.src.ts │ │ │ ├── type-reference-comments.src.ts │ │ │ ├── typed-this.src.ts │ │ │ ├── abstract-class-with-abstract-constructor.src.ts │ │ │ ├── abstract-class-with-abstract-properties.src.ts │ │ │ ├── class-with-extends-and-implements.src.ts │ │ │ ├── class-with-implements-and-extends.src.ts │ │ │ ├── class-with-optional-methods.src.ts │ │ │ ├── class-with-optional-properties.src.ts │ │ │ ├── function-with-object-type-with-optional-properties.src.ts │ │ │ ├── abstract-class-with-optional-method.src.ts │ │ │ ├── class-with-export-parameter-properties.src.ts │ │ │ ├── non-null-assertion-operator.src.ts │ │ │ ├── type-guard-in-arrow-function.src.ts │ │ │ ├── abstract-class-with-abstract-readonly-property.src.ts │ │ │ ├── class-with-constructor-and-type-parameters.src.ts │ │ │ ├── class-with-static-parameter-properties.src.ts │ │ │ ├── interface-with-construct-signature-with-parameter-accessibility.src.ts │ │ │ ├── abstract-class-with-abstract-method.src.ts │ │ │ ├── class-with-constructor-and-modifier.src.ts │ │ │ ├── class-with-constructor-and-return-type.src.ts │ │ │ ├── class-with-property-function.src.ts │ │ │ ├── class-with-property-values.src.ts │ │ │ ├── interface-with-jsdoc.src.ts │ │ │ ├── interface-with-optional-properties.src.ts │ │ │ ├── function-with-types-assignation.src.ts │ │ │ ├── object-with-escaped-properties.src.ts │ │ │ ├── async-function-with-var-declaration.src.ts │ │ │ ├── class-with-two-methods-computed-constructor.src.ts │ │ │ ├── class-with-readonly-parameter-properties.src.ts │ │ │ ├── destructuring-assignment-nested.src.ts │ │ │ ├── type-parameters-comments.src.ts │ │ │ ├── function-overloads.src.ts │ │ │ ├── type-guard-in-method.src.ts │ │ │ ├── class-with-public-parameter-properties.src.ts │ │ │ ├── class-with-accessibility-modifiers.src.ts │ │ │ ├── class-with-private-parameter-properties.src.ts │ │ │ ├── object-with-typed-methods.src.ts │ │ │ ├── class-with-mixin.src.ts │ │ │ ├── class-with-protected-parameter-properties.src.ts │ │ │ └── interface-with-all-property-types.src.ts │ │ ├── declare │ │ │ ├── variable.src.ts │ │ │ ├── class.src.ts │ │ │ ├── function.src.ts │ │ │ ├── module.src.ts │ │ │ ├── type-alias.src.ts │ │ │ ├── interface.src.ts │ │ │ ├── namespace.src.ts │ │ │ ├── abstract-class.src.ts │ │ │ └── enum.src.ts │ │ ├── expressions │ │ │ ├── new-expression-type-arguments.src.ts │ │ │ ├── call-expression-type-arguments.src.ts │ │ │ └── tagged-template-expression-type-arguments.src.ts │ │ ├── decorators │ │ │ ├── class-decorators │ │ │ │ ├── class-decorator.src.ts │ │ │ │ └── class-decorator-factory.src.ts │ │ │ ├── property-decorators │ │ │ │ ├── property-decorator-instance-member.src.ts │ │ │ │ ├── property-decorator-static-member.src.ts │ │ │ │ ├── property-decorator-factory-instance-member.src.ts │ │ │ │ └── property-decorator-factory-static-member.src.ts │ │ │ ├── method-decorators │ │ │ │ ├── method-decorator-static-member.src.ts │ │ │ │ ├── method-decorator-instance-member.src.ts │ │ │ │ ├── method-decorator-factory-static-member.src.ts │ │ │ │ └── method-decorator-factory-instance-member.src.ts │ │ │ ├── accessor-decorators │ │ │ │ ├── accessor-decorator-instance-member.src.ts │ │ │ │ ├── accessor-decorator-factory-instance-member.src.ts │ │ │ │ ├── accessor-decorator-factory-static-member.src.ts │ │ │ │ └── accessor-decorator-static-member.src.ts │ │ │ └── parameter-decorators │ │ │ │ ├── parameter-decorator-decorator-instance-member.src.ts │ │ │ │ ├── parameter-decorator-decorator-static-member.src.ts │ │ │ │ ├── parameter-decorator-instance-member.src.ts │ │ │ │ ├── parameter-decorator-constructor.src.ts │ │ │ │ └── parameter-decorator-static-member.src.ts │ │ ├── babylon-convergence │ │ │ ├── type-parameter-whitespace-loc.src.ts │ │ │ └── type-parameters.src.ts │ │ └── namespaces-and-modules │ │ │ ├── shorthand-ambient-module-declaration.src.ts │ │ │ ├── ambient-module-declaration-with-import.src.ts │ │ │ ├── declare-namespace-with-exported-function.src.ts │ │ │ ├── global-module-declaration.src.ts │ │ │ ├── module-with-default-exports.src.ts │ │ │ └── nested-internal-module.src.ts │ ├── comments │ │ ├── line-comment-with-block-syntax.src.js │ │ ├── no-comment-regex.src.js │ │ ├── no-comment-template.src.js │ │ ├── block-trailing-comment.src.js │ │ ├── comment-within-condition.src.js │ │ ├── type-assertion-regression-test.src.ts │ │ ├── mix-line-and-block-comments.src.js │ │ ├── jsx-text-with-url.src.js │ │ ├── jsx-with-operators.src.js │ │ ├── surrounding-call-comments.src.js │ │ ├── surrounding-while-loop-comments.src.js │ │ ├── switch-no-default-comment.src.js │ │ ├── template-string-block.src.js │ │ ├── jsx-comment-after-jsx.src.js │ │ ├── jsx-with-greather-than.src.js │ │ ├── surrounding-return-comments.src.js │ │ ├── surrounding-throw-comments.src.js │ │ ├── surrounding-debugger-comments.src.js │ │ ├── jsx-comment-after-self-closing-jsx.src.js │ │ ├── jsx-block-comment.src.js │ │ ├── switch-fallthrough-comment.src.js │ │ ├── jsx-text-with-multiline-non-comment.src.js │ │ ├── jsdoc-comment.src.js │ │ ├── jsx-tag-comments.src.js │ │ ├── export-default-anonymous-class.src.js │ │ ├── switch-no-default-comment-in-function.src.js │ │ ├── switch-fallthrough-comment-in-function.src.js │ │ └── switch-no-default-comment-in-nested-functions.src.js │ ├── jsx-useJSXTextNode │ │ ├── test-content.src.js │ │ └── self-closing-tag-inside-tag.src.js │ └── tsx │ │ ├── generic-jsx-element.src.tsx │ │ └── react-typed-props.src.tsx ├── jsx-known-issues.ts ├── lib │ ├── javascript.ts │ ├── typescript.ts │ ├── parse.ts │ ├── tsx.ts │ ├── comments.ts │ ├── semantic-diagnostics-enabled.ts │ └── jsx.ts └── ast-alignment │ └── spec.ts ├── .gitattributes ├── .gitignore ├── .codecov.yml ├── .editorconfig ├── tsconfig.json ├── .github └── ISSUE_TEMPLATE.md ├── jest.config.js ├── .travis.yml ├── src ├── estree │ ├── experimental.ts │ └── extensions.ts └── ast-converter.ts ├── LICENSE ├── tools └── test-utils.ts └── package.json /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | tests/fixtures/**/* -------------------------------------------------------------------------------- /tests/fixtures/jsx/self-closing-tag.src.js: -------------------------------------------------------------------------------- 1 | ; -------------------------------------------------------------------------------- /tests/fixtures/semanticInfo/badTSConfig/app.ts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/fixtures/jsx/empty-placeholder.src.js: -------------------------------------------------------------------------------- 1 | {}; -------------------------------------------------------------------------------- /tests/fixtures/jsx/invalid-attribute.src.js: -------------------------------------------------------------------------------- 1 | ; -------------------------------------------------------------------------------- /tests/fixtures/jsx/invalid-no-tag-name.src.js: -------------------------------------------------------------------------------- 1 | ; -------------------------------------------------------------------------------- /tests/fixtures/jsx/invalid-broken-tag.src.js: -------------------------------------------------------------------------------- 1 | x); -------------------------------------------------------------------------------- /tests/fixtures/javascript/basics/instanceof.src.js: -------------------------------------------------------------------------------- 1 | '' instanceof Set -------------------------------------------------------------------------------- /tests/fixtures/javascript/bigIntLiterals/binary.src.js: -------------------------------------------------------------------------------- 1 | 0b1n; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/binaryLiterals/invalid.src.js: -------------------------------------------------------------------------------- 1 | 0b102; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/binaryLiterals/lowercase.src.js: -------------------------------------------------------------------------------- 1 | 0b101; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/binaryLiterals/uppercase.src.js: -------------------------------------------------------------------------------- 1 | 0B101; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/class-expression.src.js: -------------------------------------------------------------------------------- 1 | (class {}); -------------------------------------------------------------------------------- /tests/fixtures/javascript/directives/raw.src.js: -------------------------------------------------------------------------------- 1 | "use\x20strict"; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/octalLiterals/invalid.src.js: -------------------------------------------------------------------------------- 1 | 0o12z; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/octalLiterals/lowercase.src.js: -------------------------------------------------------------------------------- 1 | 0o717; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/octalLiterals/uppercase.src.js: -------------------------------------------------------------------------------- 1 | 0O717; 2 | -------------------------------------------------------------------------------- /tests/fixtures/jsx/invalid-leading-dot-tag-name.src.js: -------------------------------------------------------------------------------- 1 | <.a>; -------------------------------------------------------------------------------- /tests/fixtures/jsx/invalid-mismatched-closing-tag.src.js: -------------------------------------------------------------------------------- 1 | ; -------------------------------------------------------------------------------- /tests/fixtures/jsx/invalid-mismatched-closing-tags.src.js: -------------------------------------------------------------------------------- 1 | ; -------------------------------------------------------------------------------- /tests/fixtures/jsx/invalid-mismatched-namespace-tag.src.js: -------------------------------------------------------------------------------- 1 | ; -------------------------------------------------------------------------------- /tests/fixtures/jsx/invalid-missing-namespace-value.src.js: -------------------------------------------------------------------------------- 1 | ; -------------------------------------------------------------------------------- /tests/fixtures/jsx/invalid-trailing-dot-tag-name.src.js: -------------------------------------------------------------------------------- 1 | ; -------------------------------------------------------------------------------- /tests/fixtures/jsx/namespaced-name-and-attribute.src.js: -------------------------------------------------------------------------------- 1 | ; -------------------------------------------------------------------------------- /tests/fixtures/jsx/tag-names-with-multi-dots.src.js: -------------------------------------------------------------------------------- 1 | ; -------------------------------------------------------------------------------- /tests/fixtures/semanticInfo/isolated-file.src.ts: -------------------------------------------------------------------------------- 1 | const x = [3, 4, 5]; -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/literal-number.src.ts: -------------------------------------------------------------------------------- 1 | let x: 0; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/tuple-empty.src.ts: -------------------------------------------------------------------------------- 1 | let x: []; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/typeof.src.ts: -------------------------------------------------------------------------------- 1 | let x: typeof y.z; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/as-param.src.js: -------------------------------------------------------------------------------- 1 | foo(() => {}); -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/block-body.src.js: -------------------------------------------------------------------------------- 1 | e => { 42; }; -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/single-param.src.js: -------------------------------------------------------------------------------- 1 | e => "test"; -------------------------------------------------------------------------------- /tests/fixtures/javascript/blockBindings/const.src.js: -------------------------------------------------------------------------------- 1 | const foo = bar; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/blockBindings/let.src.js: -------------------------------------------------------------------------------- 1 | let foo = bar; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/empty-class-semi.src.js: -------------------------------------------------------------------------------- 1 | class A {;}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/array-member.src.js: -------------------------------------------------------------------------------- 1 | [ok.v] = 20; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/defaults-array.src.js: -------------------------------------------------------------------------------- 1 | [x=10] = x -------------------------------------------------------------------------------- /tests/fixtures/javascript/forIn/for-in-array.src.js: -------------------------------------------------------------------------------- 1 | for (i in []) {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/forIn/for-in-object.src.js: -------------------------------------------------------------------------------- 1 | for ((i in {})); 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/globalReturn/return-no-arg.src.js: -------------------------------------------------------------------------------- 1 | return; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-var.src.js: -------------------------------------------------------------------------------- 1 | export var bar; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/import-module.src.js: -------------------------------------------------------------------------------- 1 | import "foo"; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/spread/error-invalid-if.src.js: -------------------------------------------------------------------------------- 1 | if (b,...a, ); -------------------------------------------------------------------------------- /tests/fixtures/javascript/spread/error-invalid-sequence.src.js: -------------------------------------------------------------------------------- 1 | (b, ...a); -------------------------------------------------------------------------------- /tests/fixtures/javascript/spread/multi-function-call.src.js: -------------------------------------------------------------------------------- 1 | foo(a, ...b); -------------------------------------------------------------------------------- /tests/fixtures/javascript/spread/not-final-param.src.js: -------------------------------------------------------------------------------- 1 | func(...a, b); -------------------------------------------------------------------------------- /tests/fixtures/javascript/spread/simple-function-call.src.js: -------------------------------------------------------------------------------- 1 | foo(...a); -------------------------------------------------------------------------------- /tests/fixtures/jsx/invalid-computed-end-tag-name.src.js: -------------------------------------------------------------------------------- 1 | ; -------------------------------------------------------------------------------- /tests/fixtures/jsx/invalid-embedded-expression.src.js: -------------------------------------------------------------------------------- 1 | {"str";}; -------------------------------------------------------------------------------- /tests/fixtures/jsx/invalid-mismatched-dot-tag-name.src.js: -------------------------------------------------------------------------------- 1 | ; -------------------------------------------------------------------------------- /tests/fixtures/jsx/invalid-missing-spread-operator.src.js: -------------------------------------------------------------------------------- 1 |
; -------------------------------------------------------------------------------- /tests/fixtures/jsx/shorthand-fragment-with-child.src.js: -------------------------------------------------------------------------------- 1 | <>
2 | -------------------------------------------------------------------------------- /tests/fixtures/jsx/spread-operator-attributes.src.js: -------------------------------------------------------------------------------- 1 |
; -------------------------------------------------------------------------------- /tests/fixtures/jsx/unknown-escape-pattern.src.js: -------------------------------------------------------------------------------- 1 | ; -------------------------------------------------------------------------------- /tests/fixtures/semanticInfo/export-file.src.ts: -------------------------------------------------------------------------------- 1 | export default [3, 4, 5]; -------------------------------------------------------------------------------- /tests/fixtures/semanticInfo/extra-file-extension.vue: -------------------------------------------------------------------------------- 1 | const x = [3, 4, 5]; -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/cast-as-multi.src.ts: -------------------------------------------------------------------------------- 1 | x as any as T; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/array-type.src.ts: -------------------------------------------------------------------------------- 1 | type Foo = string[] 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/literal-string.src.ts: -------------------------------------------------------------------------------- 1 | let x: "foo"; 2 | -------------------------------------------------------------------------------- /tests/fixtures/comments/line-comment-with-block-syntax.src.js: -------------------------------------------------------------------------------- 1 | // /*test*/ 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/error-dup-params.src.js: -------------------------------------------------------------------------------- 1 | (a, a) => 42; -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/error-reverse-arrow.src.js: -------------------------------------------------------------------------------- 1 | () <= 42; -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/iife.src.js: -------------------------------------------------------------------------------- 1 | e => ({ property: 42 }); -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/not-strict-eval.src.js: -------------------------------------------------------------------------------- 1 | eval => 42; -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/not-strict-octal.src.js: -------------------------------------------------------------------------------- 1 | (a) => 00; -------------------------------------------------------------------------------- /tests/fixtures/javascript/basics/delete-expression.src.js: -------------------------------------------------------------------------------- 1 | delete foo.bar; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/basics/typeof-expression.src.js: -------------------------------------------------------------------------------- 1 | typeof 'str' 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/empty-class-double-semi.src.js: -------------------------------------------------------------------------------- 1 | class A {}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/named-class-expression.src.js: -------------------------------------------------------------------------------- 1 | (class A {}); -------------------------------------------------------------------------------- /tests/fixtures/javascript/defaultParams/declaration.src.js: -------------------------------------------------------------------------------- 1 | function f(a = 1) {} -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/array-to-array.src.js: -------------------------------------------------------------------------------- 1 | [a, b] = [b, a]; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/defaults-object.src.js: -------------------------------------------------------------------------------- 1 | var {x = 10} = x -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/object-var-named.src.js: -------------------------------------------------------------------------------- 1 | var {a:b} = {}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/sparse-array.src.js: -------------------------------------------------------------------------------- 1 | [a,,b] = array; -------------------------------------------------------------------------------- /tests/fixtures/javascript/globalReturn/return-true.src.js: -------------------------------------------------------------------------------- 1 | return true; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-named-empty.src.js: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/invalid-await.src.js: -------------------------------------------------------------------------------- 1 | export var await; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/regex/regexp-simple.src.js: -------------------------------------------------------------------------------- 1 | var foo = /foo./; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/restParams/basic-rest.src.js: -------------------------------------------------------------------------------- 1 | function f(a, ...b) {}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/restParams/single-rest.src.js: -------------------------------------------------------------------------------- 1 | function f(...b) {}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/templateStrings/simple-template-string.src.js: -------------------------------------------------------------------------------- 1 | `42`; -------------------------------------------------------------------------------- /tests/fixtures/jsx-useJSXTextNode/test-content.src.js: -------------------------------------------------------------------------------- 1 |
@test content
; -------------------------------------------------------------------------------- /tests/fixtures/jsx/embedded-comment.src.js: -------------------------------------------------------------------------------- 1 |
{/* this is a comment */}; -------------------------------------------------------------------------------- /tests/fixtures/jsx/embedded-conditional.src.js: -------------------------------------------------------------------------------- 1 | : } />; -------------------------------------------------------------------------------- /tests/fixtures/jsx/invalid-namespace-name-with-docts.src.js: -------------------------------------------------------------------------------- 1 | ; -------------------------------------------------------------------------------- /tests/fixtures/jsx/invalid-namespace-value-with-dots.src.js: -------------------------------------------------------------------------------- 1 | ; -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/export-assignment.src.ts: -------------------------------------------------------------------------------- 1 | export = foo; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/keyof-operator.src.ts: -------------------------------------------------------------------------------- 1 | type x = keyof foo; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/typed-keyword-null.src.ts: -------------------------------------------------------------------------------- 1 | type Foo = null 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/typed-keyword-true.src.ts: -------------------------------------------------------------------------------- 1 | type Foo = true 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/typed-keyword-void.src.ts: -------------------------------------------------------------------------------- 1 | type Foo = void 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/declare/variable.src.ts: -------------------------------------------------------------------------------- 1 | declare var foo: any; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/literal-number-negative.src.ts: -------------------------------------------------------------------------------- 1 | let x: -1; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/error-missing-paren.src.js: -------------------------------------------------------------------------------- 1 | (a, (b)) => 42; -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/error-numeric-param.src.js: -------------------------------------------------------------------------------- 1 | (10) => 0; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/error-wrapped-param.src.js: -------------------------------------------------------------------------------- 1 | ((a)) => 42; -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/multiple-params.src.js: -------------------------------------------------------------------------------- 1 | (a, b) => "test"; -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/no-auto-return.src.js: -------------------------------------------------------------------------------- 1 | (a, b) => { 42; }; -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/return-arrow-function.src.js: -------------------------------------------------------------------------------- 1 | x => y => 42; -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/single-param-parens.src.js: -------------------------------------------------------------------------------- 1 | (e) => "test"; -------------------------------------------------------------------------------- /tests/fixtures/javascript/basics/void-expression.src.js: -------------------------------------------------------------------------------- 1 | void 4; 2 | void(3); 3 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/class-two-methods.src.js: -------------------------------------------------------------------------------- 1 | class A {a(){}b(){}}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/invalid-class-declaration.src.js: -------------------------------------------------------------------------------- 1 | class {}; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/defaultParams/expression.src.js: -------------------------------------------------------------------------------- 1 | x = function(y = 1) {} -------------------------------------------------------------------------------- /tests/fixtures/javascript/defaultParams/method.src.js: -------------------------------------------------------------------------------- 1 | x = { f: function(a=1) {} } -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-forOf/loop.src.js: -------------------------------------------------------------------------------- 1 | for ([a] of foo); 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/array-var-undefined.src.js: -------------------------------------------------------------------------------- 1 | var [a] = []; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/object-var-undefined.src.js: -------------------------------------------------------------------------------- 1 | var {a} = {}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/params-array.src.js: -------------------------------------------------------------------------------- 1 | function x([ a, b ]){}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/params-object.src.js: -------------------------------------------------------------------------------- 1 | function x({ a, b }){}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/for/for-loop.src.js: -------------------------------------------------------------------------------- 1 | for(var i = 0; i < 10; i++) {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/forIn/for-in-object-with-body.src.js: -------------------------------------------------------------------------------- 1 | for (i in {}) {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/globalReturn/return-identifier.src.js: -------------------------------------------------------------------------------- 1 | return fooz; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/importMeta/simple-import-meta.src.js: -------------------------------------------------------------------------------- 1 | import.meta.url; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-from-batch.src.js: -------------------------------------------------------------------------------- 1 | export * from "foo"; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-named-specifier.src.js: -------------------------------------------------------------------------------- 1 | export {foo}; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-var-number.src.js: -------------------------------------------------------------------------------- 1 | export var foo = 1; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/import-default.src.js: -------------------------------------------------------------------------------- 1 | import foo from "foo"; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/import-jquery.src.js: -------------------------------------------------------------------------------- 1 | import $ from "jquery" 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/invalid-class.src.js: -------------------------------------------------------------------------------- 1 | export default class {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/invalid-export-batch-token.src.js: -------------------------------------------------------------------------------- 1 | export * + 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/regexUFlag/regex-u-simple.src.js: -------------------------------------------------------------------------------- 1 | var foo = /foo/u; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/regexYFlag/regexp-y-simple.src.js: -------------------------------------------------------------------------------- 1 | var foo = /foo/y; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/restParams/error-not-last.src.js: -------------------------------------------------------------------------------- 1 | function f(a, ...b, c); -------------------------------------------------------------------------------- /tests/fixtures/javascript/simple-literals/literal-float.src.js: -------------------------------------------------------------------------------- 1 | const a = 1.5; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/simple-literals/literal-null.src.js: -------------------------------------------------------------------------------- 1 | const a = null; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/simple-literals/literal-number.src.js: -------------------------------------------------------------------------------- 1 | const a = 1; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/simple-literals/literal-string.src.js: -------------------------------------------------------------------------------- 1 | const a = 'a'; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/templateStrings/error-octal-literal.src.js: -------------------------------------------------------------------------------- 1 | `\07`; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/templateStrings/single-dollar-sign.src.js: -------------------------------------------------------------------------------- 1 | var ts = `$`; -------------------------------------------------------------------------------- /tests/fixtures/jsx/attributes.src.js: -------------------------------------------------------------------------------- 1 | test -------------------------------------------------------------------------------- /tests/fixtures/jsx/invalid-attribute-missing-equals.src.js: -------------------------------------------------------------------------------- 1 |
; -------------------------------------------------------------------------------- /tests/fixtures/jsx/invalid-shorthand-fragment-no-closing.src.js: -------------------------------------------------------------------------------- 1 | <>
2 | -------------------------------------------------------------------------------- /tests/fixtures/jsx/invalid-unexpected-comma.src.js: -------------------------------------------------------------------------------- 1 | ; -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/cast-as-expression.src.ts: -------------------------------------------------------------------------------- 1 | x < y as boolean; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/cast-as-operator.src.ts: -------------------------------------------------------------------------------- 1 | x === 1 as number; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/cast-as-simple.src.ts: -------------------------------------------------------------------------------- 1 | const foo = x as any; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/typed-keyword-bigint.src.ts: -------------------------------------------------------------------------------- 1 | type Foo = bigint 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/typed-keyword-false.src.ts: -------------------------------------------------------------------------------- 1 | type Foo = false 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/typed-keyword-never.src.ts: -------------------------------------------------------------------------------- 1 | type Foo = never 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/typed-keyword-number.src.ts: -------------------------------------------------------------------------------- 1 | type Foo = number 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/typed-keyword-object.src.ts: -------------------------------------------------------------------------------- 1 | type Foo = object 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/typed-keyword-string.src.ts: -------------------------------------------------------------------------------- 1 | type Foo = string 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/typed-keyword-symbol.src.ts: -------------------------------------------------------------------------------- 1 | type Foo = symbol 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/unique-symbol.src.ts: -------------------------------------------------------------------------------- 1 | type A = unique symbol; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/var-with-dotted-type.src.ts: -------------------------------------------------------------------------------- 1 | var foo: A.B.C; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/declare/class.src.ts: -------------------------------------------------------------------------------- 1 | declare class Foo { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/declare/function.src.ts: -------------------------------------------------------------------------------- 1 | declare function foo(): void 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/declare/module.src.ts: -------------------------------------------------------------------------------- 1 | declare module Foo { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/declare/type-alias.src.ts: -------------------------------------------------------------------------------- 1 | declare type Foo = string 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/empty-type-arguments.src.ts: -------------------------------------------------------------------------------- 1 | const foo: Foo<> -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/function-generic.src.ts: -------------------------------------------------------------------------------- 1 | let f: (a: T) => T; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/reference-generic.src.ts: -------------------------------------------------------------------------------- 1 | let x: Array; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/tuple-rest.src.ts: -------------------------------------------------------------------------------- 1 | let x: [string, ...number[]] 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/tuple-type.src.ts: -------------------------------------------------------------------------------- 1 | type Foo = [string, string?] 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/tuple.src.ts: -------------------------------------------------------------------------------- 1 | let x: [number, number, number]; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/type-literal.src.ts: -------------------------------------------------------------------------------- 1 | let obj: { x: number }; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/union-type.src.ts: -------------------------------------------------------------------------------- 1 | type Foo = string & number 2 | -------------------------------------------------------------------------------- /tests/fixtures/comments/no-comment-regex.src.js: -------------------------------------------------------------------------------- 1 | const regex = /no comment\/**foo/; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrayLiteral/array-literal-in-lhs.src.js: -------------------------------------------------------------------------------- 1 | fn([]).x = obj; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrayLiteral/array-literals-in-binary-expr.src.js: -------------------------------------------------------------------------------- 1 | [] + []; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/as-param-with-params.src.js: -------------------------------------------------------------------------------- 1 | foo((x, y) => {}); -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/block-body-not-object.src.js: -------------------------------------------------------------------------------- 1 | e => { label: 42 }; -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/error-two-lines.src.js: -------------------------------------------------------------------------------- 1 | var a = () 2 | => 0; -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/not-strict-arguments.src.js: -------------------------------------------------------------------------------- 1 | arguments => 42; -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/not-strict-eval-params.src.js: -------------------------------------------------------------------------------- 1 | (eval, a) => 42; -------------------------------------------------------------------------------- /tests/fixtures/javascript/basics/new-with-member-expression.src.js: -------------------------------------------------------------------------------- 1 | new foo.bar(); 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/basics/new-without-parens.src.js: -------------------------------------------------------------------------------- 1 | function X () {} 2 | new X; -------------------------------------------------------------------------------- /tests/fixtures/javascript/callExpression/call-expression-with-array.src.js: -------------------------------------------------------------------------------- 1 | foo([]); 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/callExpression/call-expression-with-object.src.js: -------------------------------------------------------------------------------- 1 | foo({}); 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/class-method-named-static.src.js: -------------------------------------------------------------------------------- 1 | class A {static(){};}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/class-one-method.src.js: -------------------------------------------------------------------------------- 1 | class A { 2 | a(){} 3 | }; -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/class-static-method.src.js: -------------------------------------------------------------------------------- 1 | class A {static a(){};}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/class-two-methods-semi.src.js: -------------------------------------------------------------------------------- 1 | class A {a(){};b(){}}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/derived-class-expression.src.js: -------------------------------------------------------------------------------- 1 | (class extends 0{}); -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-spread/not-final-array.src.js: -------------------------------------------------------------------------------- 1 | [...a, b] = c; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-spread/single-destructured.src.js: -------------------------------------------------------------------------------- 1 | [...a] = b; -------------------------------------------------------------------------------- /tests/fixtures/javascript/generators/empty-generator-declaration.src.js: -------------------------------------------------------------------------------- 1 | function* t() {}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/generators/yield-delegation.src.js: -------------------------------------------------------------------------------- 1 | (function* () { yield *v }); -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-default-array.src.js: -------------------------------------------------------------------------------- 1 | export default []; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-default-number.src.js: -------------------------------------------------------------------------------- 1 | export default 42; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-default-value.src.js: -------------------------------------------------------------------------------- 1 | export default foo; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-function.src.js: -------------------------------------------------------------------------------- 1 | export function foo () {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-named-specifiers.src.js: -------------------------------------------------------------------------------- 1 | export {foo, bar}; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/import-named-empty.src.js: -------------------------------------------------------------------------------- 1 | import {} from "foo"; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/newTarget/invalid-new-target.src.js: -------------------------------------------------------------------------------- 1 | var x = new.target; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/objectLiteral/object-literal-in-lhs.src.js: -------------------------------------------------------------------------------- 1 | fn({}).x = obj; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/restParams/error-no-default.src.js: -------------------------------------------------------------------------------- 1 | function f(a, ...b = 0); -------------------------------------------------------------------------------- /tests/fixtures/javascript/restParams/func-expression.src.js: -------------------------------------------------------------------------------- 1 | var x = function (...a) {}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/restParams/invalid-rest-param.src.js: -------------------------------------------------------------------------------- 1 | function x(...{ a }){}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/templateStrings/tagged-no-placeholders.src.js: -------------------------------------------------------------------------------- 1 | foo`foo`; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/unicodeCodePointEscapes/invalid-empty-escape.src.js: -------------------------------------------------------------------------------- 1 | "\u{}"; -------------------------------------------------------------------------------- /tests/fixtures/jsx/invalid-computed-string-end-tag-name.src.js: -------------------------------------------------------------------------------- 1 | ; -------------------------------------------------------------------------------- /tests/fixtures/jsx/invalid-missing-closing-tag-attribute-placeholder.src.js: -------------------------------------------------------------------------------- 1 |
; -------------------------------------------------------------------------------- /tests/fixtures/jsx/invalid-no-common-parent.src.js: -------------------------------------------------------------------------------- 1 | var x =
one
two
; -------------------------------------------------------------------------------- /tests/fixtures/jsx/invalid-placeholder-in-closing-tag.src.js: -------------------------------------------------------------------------------- 1 |
stuff
; -------------------------------------------------------------------------------- /tests/fixtures/tsx/generic-jsx-element.src.tsx: -------------------------------------------------------------------------------- 1 | data={12} /> 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/destructuring-assignment.src.ts: -------------------------------------------------------------------------------- 1 | ({ foo = [] } = bar); -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/export-as-namespace.src.ts: -------------------------------------------------------------------------------- 1 | export as namespace a; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/type-assertion.src.ts: -------------------------------------------------------------------------------- 1 | const foo = 2; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/typed-keyword-boolean.src.ts: -------------------------------------------------------------------------------- 1 | type Foo = boolean 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/typed-keyword-undefined.src.ts: -------------------------------------------------------------------------------- 1 | type Foo = undefined 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/typed-keyword-unknown.src.ts: -------------------------------------------------------------------------------- 1 | type Foo = unknown 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/unknown-type-annotation.src.ts: -------------------------------------------------------------------------------- 1 | let foo: unknown; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/function-in-generic.src.ts: -------------------------------------------------------------------------------- 1 | let x: Array<() => void>; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/mapped.src.ts: -------------------------------------------------------------------------------- 1 | let map: { [P in string]: number; }; 2 | -------------------------------------------------------------------------------- /tests/fixtures/comments/no-comment-template.src.js: -------------------------------------------------------------------------------- 1 | const str = `${__dirname}/test/*.js`; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/error-not-arrow.src.js: -------------------------------------------------------------------------------- 1 | left = (aSize.width/2) - () -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/error-numeric-param-multi.src.js: -------------------------------------------------------------------------------- 1 | (10, 20) => 0; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/error-strict-octal.src.js: -------------------------------------------------------------------------------- 1 | "use strict"; (a) => 00; -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/return-sequence.src.js: -------------------------------------------------------------------------------- 1 | (x) => ((y, z) => (x, y, z)); -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/single-param-return-identifier.src.js: -------------------------------------------------------------------------------- 1 | (sun) => earth; -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/class-method-named-prototype.src.js: -------------------------------------------------------------------------------- 1 | class A {prototype(){}}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/class-two-methods-three-semi.src.js: -------------------------------------------------------------------------------- 1 | class A {;a(){};b(){};}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/class-two-methods-two-semi.src.js: -------------------------------------------------------------------------------- 1 | class A {a(){};b(){};}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/class-with-constructor.src.js: -------------------------------------------------------------------------------- 1 | class A {constructor(){}}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/empty-literal-derived-class.src.js: -------------------------------------------------------------------------------- 1 | class A extends 0 {}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/named-derived-class-expression.src.js: -------------------------------------------------------------------------------- 1 | (class A extends 0{}); -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-spread/multi-destructured.src.js: -------------------------------------------------------------------------------- 1 | [a, ...b] = c; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/defaults-array-multi.src.js: -------------------------------------------------------------------------------- 1 | var [x = 10, y, z] = a; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/defaults-object-longform.src.js: -------------------------------------------------------------------------------- 1 | var { x: x = 10 } = x; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/defaults-object-multi.src.js: -------------------------------------------------------------------------------- 1 | var {x = 10, y, z} = a; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/named-param.src.js: -------------------------------------------------------------------------------- 1 | ({ responseText: text } = res); -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/nested-array.src.js: -------------------------------------------------------------------------------- 1 | var [x, , [, z]] = [1,2,[3,4]]; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/param-defaults-array.src.js: -------------------------------------------------------------------------------- 1 | function a([x = 10]) {} -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/param-defaults-object.src.js: -------------------------------------------------------------------------------- 1 | function a({x = 10}) {} -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/params-array-wrapped.src.js: -------------------------------------------------------------------------------- 1 | (function x([ a, b ]){}); -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/params-object-wrapped.src.js: -------------------------------------------------------------------------------- 1 | (function x({ a, b }){}); -------------------------------------------------------------------------------- /tests/fixtures/javascript/for/for-with-const.src.js: -------------------------------------------------------------------------------- 1 | for (const i = 0; i < j;) 2 | { 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/for/for-with-let.src.js: -------------------------------------------------------------------------------- 1 | for (const i = 0; i < j;) 2 | { 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/forIn/for-in-with-bare-assigment.src.js: -------------------------------------------------------------------------------- 1 | for (x = 0 in arr); 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/forIn/for-in-with-var.src.js: -------------------------------------------------------------------------------- 1 | for (var x in list) process(x); 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/generators/anonymous-generator.src.js: -------------------------------------------------------------------------------- 1 | (function* () { yield v }); -------------------------------------------------------------------------------- /tests/fixtures/javascript/generators/double-yield.src.js: -------------------------------------------------------------------------------- 1 | (function* () { yield yield 10 }); -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/error-delete.src.js: -------------------------------------------------------------------------------- 1 | import x from "x"; 2 | delete x; 3 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-default-object.src.js: -------------------------------------------------------------------------------- 1 | export default { foo: 1 }; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-from-default.src.js: -------------------------------------------------------------------------------- 1 | export {default} from "foo"; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-from-specifier.src.js: -------------------------------------------------------------------------------- 1 | export {foo} from "foo"; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-named-as-default.src.js: -------------------------------------------------------------------------------- 1 | export {foo as default}; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-named-as-specifier.src.js: -------------------------------------------------------------------------------- 1 | export {foo as bar}; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/import-named-specifier.src.js: -------------------------------------------------------------------------------- 1 | import {bar} from "foo"; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/invalid-export-default-equal.src.js: -------------------------------------------------------------------------------- 1 | export default = 42 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/invalid-export-default-token.src.js: -------------------------------------------------------------------------------- 1 | export {default} + 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/invalid-export-default.src.js: -------------------------------------------------------------------------------- 1 | export default from "foo" 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/invalid-export-named-default.src.js: -------------------------------------------------------------------------------- 1 | export {default} 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/invalid-import-default.src.js: -------------------------------------------------------------------------------- 1 | import default from "foo" 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/octalLiterals/strict-uppercase.src.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 0O717; 3 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/simple-literals/literal-float-negative.src.js: -------------------------------------------------------------------------------- 1 | const a = -1.5; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/simple-literals/literal-number-negative.src.js: -------------------------------------------------------------------------------- 1 | const a = -1; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/simple-literals/literal-undefined.src.js: -------------------------------------------------------------------------------- 1 | const a = undefined; 2 | -------------------------------------------------------------------------------- /tests/fixtures/jsx/self-closing-tag-inside-tag.src.js: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/abstract-interface.src.ts: -------------------------------------------------------------------------------- 1 | export abstract interface I { 2 | } -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/cast-as-multi-assign.src.ts: -------------------------------------------------------------------------------- 1 | (a as number as any) = 42; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/interface-with-generic.src.ts: -------------------------------------------------------------------------------- 1 | interface Test { 2 | } 3 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/declare/interface.src.ts: -------------------------------------------------------------------------------- 1 | declare interface Foo { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/declare/namespace.src.ts: -------------------------------------------------------------------------------- 1 | declare namespace Foo { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/decorator-on-enum-declaration.src.ts: -------------------------------------------------------------------------------- 1 | @dec enum E {} -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/constructor-generic.src.ts: -------------------------------------------------------------------------------- 1 | let f: new (a: T) => T; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/function-with-this.src.ts: -------------------------------------------------------------------------------- 1 | let f: (this: number) => void; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/function.src.ts: -------------------------------------------------------------------------------- 1 | let f: (a: number, b?: number) => void; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/parenthesized-type.src.ts: -------------------------------------------------------------------------------- 1 | type Foo = (string | number) 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.js eol=lf 3 | *.ts eol=lf 4 | *.tsx eol=lf 5 | *.yml eol=lf 6 | -------------------------------------------------------------------------------- /tests/fixtures/comments/block-trailing-comment.src.js: -------------------------------------------------------------------------------- 1 | { 2 | a(); 3 | //comment 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/comments/comment-within-condition.src.js: -------------------------------------------------------------------------------- 1 | /* foo */ 2 | if (/* bar */ a) {} 3 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/error-strict-dup-params.src.js: -------------------------------------------------------------------------------- 1 | "use strict"; (a, a) => 42; -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/error-strict-eval-return.src.js: -------------------------------------------------------------------------------- 1 | "use strict"; (eval) => 42 -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/error-strict-eval.src.js: -------------------------------------------------------------------------------- 1 | (eval) => { "use strict"; 42 } -------------------------------------------------------------------------------- /tests/fixtures/javascript/callExpression/new-expression-with-object.src.js: -------------------------------------------------------------------------------- 1 | new bar({}); 2 | 3 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/class-accessor-properties.src.js: -------------------------------------------------------------------------------- 1 | class A {get a(){} set b(c){};}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/class-computed-static-method.src.js: -------------------------------------------------------------------------------- 1 | class A {static [a](){};}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/derived-class-assign-to-var.src.js: -------------------------------------------------------------------------------- 1 | var x = class A extends 0{}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/invalid-class-two-super-classes.src.js: -------------------------------------------------------------------------------- 1 | class A extends B, C {} -------------------------------------------------------------------------------- /tests/fixtures/javascript/defaultParams/not-all-params.src.js: -------------------------------------------------------------------------------- 1 | var foo = function(a, b = 42, c) {}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-array.src.js: -------------------------------------------------------------------------------- 1 | ([y]) => x; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-object.src.js: -------------------------------------------------------------------------------- 1 | ({y}) => x; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-blockBindings/array-let-undefined.src.js: -------------------------------------------------------------------------------- 1 | let [a] = []; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-blockBindings/object-let-named.src.js: -------------------------------------------------------------------------------- 1 | let {a:b} = {}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-blockBindings/object-let-undefined.src.js: -------------------------------------------------------------------------------- 1 | let {a} = {}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-spread/var-multi-destructured.src.js: -------------------------------------------------------------------------------- 1 | var [a, ...b] = c; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-spread/var-single-destructured.src.js: -------------------------------------------------------------------------------- 1 | var [...a] = b; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/call-expression-destruction-array.src.js: -------------------------------------------------------------------------------- 1 | foo(...[]); 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/call-expression-destruction-object.src.js: -------------------------------------------------------------------------------- 1 | foo(...{}); 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/defaults-array-all.src.js: -------------------------------------------------------------------------------- 1 | var [x = 10, y = 5, z = 1] = a; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/defaults-array-nested-multi.src.js: -------------------------------------------------------------------------------- 1 | var [x = 10, [ z ]] = a; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/defaults-object-all.src.js: -------------------------------------------------------------------------------- 1 | var {x = 10, y = 5, z = 1} = a; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/params-multi-object.src.js: -------------------------------------------------------------------------------- 1 | function x(a, { b }){}; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/params-nested-array.src.js: -------------------------------------------------------------------------------- 1 | function a([x, , [, z]]) {}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/forIn/for-in-destruction.src.js: -------------------------------------------------------------------------------- 1 | for (var [name, value] in obj) {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/forIn/for-in-with-const.src.js: -------------------------------------------------------------------------------- 1 | for (const x in list) process(x); 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/forIn/for-in-with-milti-asigment.src.js: -------------------------------------------------------------------------------- 1 | for (var x = y = z in q); 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/forOf/for-of-array.src.js: -------------------------------------------------------------------------------- 1 | for (let x of []) 2 | doSomething(); 3 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/forOf/for-of-destruction.src.js: -------------------------------------------------------------------------------- 1 | for (var [name, value] of obj) {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/forOf/for-of-object.src.js: -------------------------------------------------------------------------------- 1 | for (let x of {}) 2 | doSomething(); 3 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/generators/generator-declaration.src.js: -------------------------------------------------------------------------------- 1 | function* test () { yield *v }; -------------------------------------------------------------------------------- /tests/fixtures/javascript/generators/yield-without-value.src.js: -------------------------------------------------------------------------------- 1 | (function* () { yield; }); 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-default-expression.src.js: -------------------------------------------------------------------------------- 1 | export default (1 + 2); 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-default-function.src.js: -------------------------------------------------------------------------------- 1 | export default function () {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-from-specifiers.src.js: -------------------------------------------------------------------------------- 1 | export {foo, bar} from "foo"; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-named-class.src.js: -------------------------------------------------------------------------------- 1 | export class Test { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-named-specifiers-comma.src.js: -------------------------------------------------------------------------------- 1 | export {foo, bar,}; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/import-default-as.src.js: -------------------------------------------------------------------------------- 1 | import {default as foo} from "foo"; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/import-named-specifiers.src.js: -------------------------------------------------------------------------------- 1 | import {bar, baz} from "foo"; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/import-null-as-nil.src.js: -------------------------------------------------------------------------------- 1 | import { null as nil } from "bar" 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/invalid-export-batch-missing-from-clause.src.js: -------------------------------------------------------------------------------- 1 | export * 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/invalid-export-named-extra-comma.src.js: -------------------------------------------------------------------------------- 1 | export {foo,baz,,} 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/invalid-export-named-middle-comma.src.js: -------------------------------------------------------------------------------- 1 | export {foo,,baz} 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/invalid-import-module-specifier.src.js: -------------------------------------------------------------------------------- 1 | export {foo} from bar 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/restParams/func-expression-multi.src.js: -------------------------------------------------------------------------------- 1 | var x = function(a, ...b) {}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/unicodeCodePointEscapes/basic-string-literal.src.js: -------------------------------------------------------------------------------- 1 | "\u{714E}\u{8336}"; -------------------------------------------------------------------------------- /tests/fixtures/javascript/unicodeCodePointEscapes/invalid-too-large-escape.src.js: -------------------------------------------------------------------------------- 1 | "\u{FFFFFF}"; -------------------------------------------------------------------------------- /tests/fixtures/jsx/embedded-invalid-js-identifier.src.js: -------------------------------------------------------------------------------- 1 |

7x invalid-js-identifier
; -------------------------------------------------------------------------------- /tests/fixtures/jsx/embedded-tags.src.js: -------------------------------------------------------------------------------- 1 | right=monkeys /> gorillas />; -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-type-parameter-underscore.src.ts: -------------------------------------------------------------------------------- 1 | class A<__P> {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-type-parameter.src.ts: -------------------------------------------------------------------------------- 1 | class Foo { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/declare-function.src.ts: -------------------------------------------------------------------------------- 1 | declare function foo(bar: string): string; -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/destructuring-assignment-object.src.ts: -------------------------------------------------------------------------------- 1 | ({ foo = {} } = bar); 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/import-equal-declaration.src.ts: -------------------------------------------------------------------------------- 1 | import foo = require('bar'); 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/expressions/new-expression-type-arguments.src.ts: -------------------------------------------------------------------------------- 1 | const a = new A(); -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/constructor-in-generic.src.ts: -------------------------------------------------------------------------------- 1 | let x: Array string>; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/constructor.src.ts: -------------------------------------------------------------------------------- 1 | let f: new (a: number, b?: number) => void; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/function-with-rest.src.ts: -------------------------------------------------------------------------------- 1 | let f: (...a: number[]) => void; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/reference-generic-nested.src.ts: -------------------------------------------------------------------------------- 1 | let x: Array>; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/type-operator.src.ts: -------------------------------------------------------------------------------- 1 | let x: keyof T; 2 | let y: unique symbol; 3 | -------------------------------------------------------------------------------- /tests/fixtures/comments/type-assertion-regression-test.src.ts: -------------------------------------------------------------------------------- 1 | const foo = // test 2 | bar; 3 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/error-strict-param-eval.src.js: -------------------------------------------------------------------------------- 1 | "use strict"; (eval, a) => 42; -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/error-strict-param-names.src.js: -------------------------------------------------------------------------------- 1 | "use strict"; (eval, a) => 42; -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/class-method-named-with-space.src.js: -------------------------------------------------------------------------------- 1 | class A {withSpace () {}} 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/class-static-method-named-static.src.js: -------------------------------------------------------------------------------- 1 | class A {static static(){};}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/invalid-class-setter-declaration.src.js: -------------------------------------------------------------------------------- 1 | class A { set foo() {}}; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-arrowFunctions/param-defaults-array.src.js: -------------------------------------------------------------------------------- 1 | ([x = 10]) => x -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-arrowFunctions/param-defaults-object.src.js: -------------------------------------------------------------------------------- 1 | ({x = 10}) => x -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-blockBindings/array-const-undefined.src.js: -------------------------------------------------------------------------------- 1 | const [a] = []; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-blockBindings/object-const-named.src.js: -------------------------------------------------------------------------------- 1 | const {a:b} = {}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-blockBindings/object-const-undefined.src.js: -------------------------------------------------------------------------------- 1 | const {a} = {}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-defaultParams/param-array.src.js: -------------------------------------------------------------------------------- 1 | function f([x] = [1]) {}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-spread/complex-destructured.src.js: -------------------------------------------------------------------------------- 1 | [{ a, b }, ...c] = d; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-spread/invalid-not-final-array-empty.src.js: -------------------------------------------------------------------------------- 1 | [...a, ] = b; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/defaults-array-nested-all.src.js: -------------------------------------------------------------------------------- 1 | var [x = 10, [ z = 10]] = a; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/defaults-object-assign.src.js: -------------------------------------------------------------------------------- 1 | ({ Object=0, String=0 } = {}) 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/defaults-object-mixed-multi.src.js: -------------------------------------------------------------------------------- 1 | var {x, y: y = 10, z} = a; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/defaults-object-nested-multi.src.js: -------------------------------------------------------------------------------- 1 | var {x = 10, y: { z }} = a; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/params-nested-object.src.js: -------------------------------------------------------------------------------- 1 | function a({x: y, z: { a: b } }) {}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/directives/program-order.src.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | "use loose"; 3 | var a; 4 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/directives/program.src.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var a = 1; 3 | "use strict"; 4 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/experimentalDynamicImport/dynamic-import.src.js: -------------------------------------------------------------------------------- 1 | import('foo').then(main); 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/experimentalObjectRestSpread/arg-spread.src.js: -------------------------------------------------------------------------------- 1 | function c({a, ...b}) {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/for/for-with-function.src.js: -------------------------------------------------------------------------------- 1 | for (x = 5; x = x.toExponential(); x = 5); 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/forIn/for-in-destruction-object.src.js: -------------------------------------------------------------------------------- 1 | for (var {name, value} in obj) {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/forIn/for-in-with-assigment.src.js: -------------------------------------------------------------------------------- 1 | for (let x = 42 in list) process(x); 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/forOf/for-of-destruction-object.src.js: -------------------------------------------------------------------------------- 1 | for (var {name, value} of obj) {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/generators/yield-without-value-no-semi.src.js: -------------------------------------------------------------------------------- 1 | (function* () { yield }); 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-default-class.src.js: -------------------------------------------------------------------------------- 1 | export default class { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-named-as-specifiers.src.js: -------------------------------------------------------------------------------- 1 | export {foo as default, bar}; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/import-named-as-specifier.src.js: -------------------------------------------------------------------------------- 1 | import {bar as baz} from "foo"; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/import-namespace-specifier.src.js: -------------------------------------------------------------------------------- 1 | import * as foo from "foo"; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/invalid-import-default-missing-module-specifier.src.js: -------------------------------------------------------------------------------- 1 | import foo 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/invalid-import-namespace-missing-as.src.js: -------------------------------------------------------------------------------- 1 | import * from "foo" 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/objectLiteralComputedProperties/standalone-expression.src.js: -------------------------------------------------------------------------------- 1 | ({[x]: 10}); 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/regexUFlag/regex-u-invalid-extended-escape.src.js: -------------------------------------------------------------------------------- 1 | var x = /\u{110000}/u; 2 | -------------------------------------------------------------------------------- /tests/fixtures/jsx/member-expression-this.src.js: -------------------------------------------------------------------------------- 1 | ; 2 | ; 3 | -------------------------------------------------------------------------------- /tests/fixtures/semanticInfo/import-file.src.ts: -------------------------------------------------------------------------------- 1 | import arr from "./export-file.src"; 2 | arr.push(6, 7); -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/async-function-expression.src.ts: -------------------------------------------------------------------------------- 1 | (async function test() { 2 | })(); -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-multi-line-keyword-abstract.src.ts: -------------------------------------------------------------------------------- 1 | abstract 2 | class B {} 3 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-multi-line-keyword-declare.src.ts: -------------------------------------------------------------------------------- 1 | declare 2 | class B {} 3 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-implements.src.ts: -------------------------------------------------------------------------------- 1 | class Foo implements Bar { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/const-enum.src.ts: -------------------------------------------------------------------------------- 1 | const enum Foo { 2 | foo = 1, 3 | bar 4 | } -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/interface-extends.src.ts: -------------------------------------------------------------------------------- 1 | interface Foo extends Bar { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/interface-type-parameters.src.ts: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/symbol-type-param.src.ts: -------------------------------------------------------------------------------- 1 | function test(abc: Map) {} -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/type-alias-declaration.src.ts: -------------------------------------------------------------------------------- 1 | type Result = Success | Failure -------------------------------------------------------------------------------- /tests/fixtures/typescript/declare/abstract-class.src.ts: -------------------------------------------------------------------------------- 1 | declare abstract class Foo { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/declare/enum.src.ts: -------------------------------------------------------------------------------- 1 | declare enum Foo { 2 | Bar, 3 | Baz 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/decorators/class-decorators/class-decorator.src.ts: -------------------------------------------------------------------------------- 1 | @sealed 2 | class Qux {} -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/class-empty-extends.src.ts: -------------------------------------------------------------------------------- 1 | class Foo extends { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/interface-implements.src.ts: -------------------------------------------------------------------------------- 1 | interface d implements e {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/expressions/call-expression-type-arguments.src.ts: -------------------------------------------------------------------------------- 1 | foo
(); 2 | foo(); -------------------------------------------------------------------------------- /tests/fixtures/typescript/expressions/tagged-template-expression-type-arguments.src.ts: -------------------------------------------------------------------------------- 1 | foo`baz`; -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/conditional.src.ts: -------------------------------------------------------------------------------- 1 | let x: number extends string ? boolean : string; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/constructor-with-rest.src.ts: -------------------------------------------------------------------------------- 1 | let f: new (...a: number[]) => void; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/tuple-optional.src.ts: -------------------------------------------------------------------------------- 1 | let x: [string, number?, (string | number)?] 2 | -------------------------------------------------------------------------------- /tests/fixtures/comments/mix-line-and-block-comments.src.js: -------------------------------------------------------------------------------- 1 | //foo 2 | var zzz /*aaa*/ = 777; 3 | //bar 4 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/error-strict-param-no-paren-eval.src.js: -------------------------------------------------------------------------------- 1 | "use strict"; eval => 42; -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/class-with-constructor-with-space.src.js: -------------------------------------------------------------------------------- 1 | class A {constructor (){}}; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-nested-array.src.js: -------------------------------------------------------------------------------- 1 | ([y, [x]]) => x; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-defaultParams/param-object-short.src.js: -------------------------------------------------------------------------------- 1 | ({f({x} = {x: 10}) {}}); -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-defaultParams/param-object.src.js: -------------------------------------------------------------------------------- 1 | f = function({x} = {x: 10}) {}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-spread/destructured-array-literal.src.js: -------------------------------------------------------------------------------- 1 | [a, ...[b, c]] = d; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-spread/destructuring-param.src.js: -------------------------------------------------------------------------------- 1 | function a([a, b, ...[ok]]) {}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-spread/var-complex-destructured.src.js: -------------------------------------------------------------------------------- 1 | var [{ a, b }, ...c] = d; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/defaults-object-nested-all.src.js: -------------------------------------------------------------------------------- 1 | var {x = 10, y: { z = 10}} = a; -------------------------------------------------------------------------------- /tests/fixtures/javascript/experimentalObjectRestSpread/spread-trailing-comma.src.js: -------------------------------------------------------------------------------- 1 | ({ a, b, ...c, }) 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/experimentalOptionalCatchBinding/optional-catch-binding.src.js: -------------------------------------------------------------------------------- 1 | try {} catch {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/forIn/for-in-with-rest.src.js: -------------------------------------------------------------------------------- 1 | for ({ x: xx, ...rrestOff } in array) { 2 | } 3 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/forOf/for-of-with-rest.src.js: -------------------------------------------------------------------------------- 1 | for ({ x: xx, ...rrestOff } of array) { 2 | } 3 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/generators/yield-without-value-in-call.src.js: -------------------------------------------------------------------------------- 1 | (function* () { fn(yield); }); 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-default-named-function.src.js: -------------------------------------------------------------------------------- 1 | export default function foo() {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-from-named-as-specifier.src.js: -------------------------------------------------------------------------------- 1 | export {foo as bar} from "foo"; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-var-anonymous-function.src.js: -------------------------------------------------------------------------------- 1 | export var foo = function () {}; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/import-named-as-specifiers.src.js: -------------------------------------------------------------------------------- 1 | import {bar as baz, xyz} from "foo"; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/import-named-specifiers-comma.src.js: -------------------------------------------------------------------------------- 1 | import {bar, baz,} from "foo"; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/invalid-import-default-after-named.src.js: -------------------------------------------------------------------------------- 1 | import {bar}, foo from "foo" 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/invalid-import-default-module-specifier.src.js: -------------------------------------------------------------------------------- 1 | import foo from bar; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/invalid-import-missing-module-specifier.src.js: -------------------------------------------------------------------------------- 1 | import { foo, bar } 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/invalid-import-named-as-missing-from.src.js: -------------------------------------------------------------------------------- 1 | import {default as foo} 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/objectLiteralComputedProperties/computed-and-identifier.src.js: -------------------------------------------------------------------------------- 1 | ({[x]: 10, y: 20}); -------------------------------------------------------------------------------- /tests/fixtures/javascript/restParams/class-method.src.js: -------------------------------------------------------------------------------- 1 | class A { 2 | foo(...bar) { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/templateStrings/escape-characters.src.js: -------------------------------------------------------------------------------- 1 | var ts = `\\n\\r\\b\\v\\t\\f\\\n\\\r\n`; -------------------------------------------------------------------------------- /tests/fixtures/javascript/unicodeCodePointEscapes/complex-string-literal.src.js: -------------------------------------------------------------------------------- 1 | "\u{20BB7}\u{10FFFF}\u{1}"; -------------------------------------------------------------------------------- /tests/fixtures/jsx-useJSXTextNode/self-closing-tag-inside-tag.src.js: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | -------------------------------------------------------------------------------- /tests/fixtures/jsx/namespaced-attribute-and-value-inserted.src.js: -------------------------------------------------------------------------------- 1 |
{value} ; -------------------------------------------------------------------------------- /tests/fixtures/jsx/newslines-and-entities.src.js: -------------------------------------------------------------------------------- 1 | \nbar\nbaz\r\n; -------------------------------------------------------------------------------- /tests/fixtures/typescript/babylon-convergence/type-parameter-whitespace-loc.src.ts: -------------------------------------------------------------------------------- 1 | function f< T >() {} -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-definite-assignment.src.ts: -------------------------------------------------------------------------------- 1 | class X { 2 | a!: string; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-generic-method.src.ts: -------------------------------------------------------------------------------- 1 | class Foo { 2 | getBar() {} 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/export-named-class-with-generic.src.ts: -------------------------------------------------------------------------------- 1 | export class Foo { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/nested-type-arguments.src.ts: -------------------------------------------------------------------------------- 1 | var nestedArray: Array>> -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/variable-declaration-type-annotation-spacing.src.ts: -------------------------------------------------------------------------------- 1 | let x : string; -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/decorator-on-interface-declaration.src.ts: -------------------------------------------------------------------------------- 1 | @deco() 2 | interface M {} -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/index-signature.src.ts: -------------------------------------------------------------------------------- 1 | type foo = { 2 | [a: string]: string; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/mapped-readonly.src.ts: -------------------------------------------------------------------------------- 1 | let map: { readonly [P in string]?: number; }; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/error-strict-default-param-eval.src.js: -------------------------------------------------------------------------------- 1 | "use strict"; (eval = 10) => 42; -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/error-strict-param-arguments.src.js: -------------------------------------------------------------------------------- 1 | "use strict"; (arguments, a) => 42; -------------------------------------------------------------------------------- /tests/fixtures/javascript/basics/update-expression.src.js: -------------------------------------------------------------------------------- 1 | var i = 0; 2 | function f() { 3 | i++; 4 | } 5 | f(); -------------------------------------------------------------------------------- /tests/fixtures/javascript/callExpression/new-expression-with-array.src.js: -------------------------------------------------------------------------------- 1 | new bar([]); 2 | new bar([[{}]]); 3 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/class-static-method-named-prototype.src.js: -------------------------------------------------------------------------------- 1 | class A {static ["prototype"](){}}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/class-two-computed-static-methods.src.js: -------------------------------------------------------------------------------- 1 | class A {static[a](){}; static[b](){}}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/class-with-constructor-parameters.src.js: -------------------------------------------------------------------------------- 1 | class A {constructor(foo, bar){}} 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-nested-object.src.js: -------------------------------------------------------------------------------- 1 | ({y, a:{x}}) => x; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-spread/var-destructured-array-literal.src.js: -------------------------------------------------------------------------------- 1 | var [a, ...[b, c]] = d; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/defaults-object-longform-multi.src.js: -------------------------------------------------------------------------------- 1 | var {x: x, y: y = 10, z: z} = a; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/invalid-defaults-object-assign.src.js: -------------------------------------------------------------------------------- 1 | ({ Object=0, String=0 }) = {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/nested-object.src.js: -------------------------------------------------------------------------------- 1 | var {x: y, z: { a: b } } = { x: "3", z: { a: "b" } }; -------------------------------------------------------------------------------- /tests/fixtures/javascript/exponentiationOperators/exponential-operators.src.js: -------------------------------------------------------------------------------- 1 | var x = 2 ** 3; 2 | x **= 4; 3 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/for/for-with-coma.src.js: -------------------------------------------------------------------------------- 1 | for (var i = 0, j = 10; i < j; i++, j--) 2 | { 3 | } 4 | 5 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/generators/async-generator-function.src.js: -------------------------------------------------------------------------------- 1 | 2 | async function *foo() { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-default-named-class.src.js: -------------------------------------------------------------------------------- 1 | export default class Test { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-from-named-as-default.src.js: -------------------------------------------------------------------------------- 1 | export {foo as default} from "foo"; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/import-default-and-named-specifiers.src.js: -------------------------------------------------------------------------------- 1 | import foo, {bar} from "foo"; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/invalid-import-named-after-named.src.js: -------------------------------------------------------------------------------- 1 | import {bar}, {foo} from "foo"; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/invalid-import-named-extra-comma.src.js: -------------------------------------------------------------------------------- 1 | import {foo,baz,,} from 'toast'; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/invalid-import-named-middle-comma.src.js: -------------------------------------------------------------------------------- 1 | import {foo,,baz} from 'toast'; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/newTarget/simple-new-target.src.js: -------------------------------------------------------------------------------- 1 | function f() { 2 | var x = new.target; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/regexUFlag/regex-u-extended-escape.src.js: -------------------------------------------------------------------------------- 1 | var x = /[\u{0000000000000061}-\u{7A}]/u; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/templateStrings/deeply-nested.src.js: -------------------------------------------------------------------------------- 1 | raw`hello ${`nested ${`deeply` + {}} blah`}`; 2 | -------------------------------------------------------------------------------- /tests/fixtures/jsx/invalid-matching-placeholder-in-closing-tag.src.js: -------------------------------------------------------------------------------- 1 |
stuff
; 2 | -------------------------------------------------------------------------------- /tests/fixtures/jsx/spread-operator-attribute-and-regular-attribute.src.js: -------------------------------------------------------------------------------- 1 |
; -------------------------------------------------------------------------------- /tests/fixtures/typescript/babylon-convergence/type-parameters.src.ts: -------------------------------------------------------------------------------- 1 | function f() {} -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-extends-generic.src.ts: -------------------------------------------------------------------------------- 1 | class Foo extends Bar { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-type-parameter-default.src.ts: -------------------------------------------------------------------------------- 1 | class Foo { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/export-named-enum.src.ts: -------------------------------------------------------------------------------- 1 | export enum Foo { 2 | foo = 1, 3 | bar 4 | } -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/export-type-alias-declaration.src.ts: -------------------------------------------------------------------------------- 1 | export type TestAlias = string | number; -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/import-export-equal-declaration.src.ts: -------------------------------------------------------------------------------- 1 | export import foo = require('bar'); 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/interface-extends-multiple.src.ts: -------------------------------------------------------------------------------- 1 | interface Foo extends Bar,Baz { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/interface-without-type-annotation.src.ts: -------------------------------------------------------------------------------- 1 | interface test { 2 | foo; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/never-type-param.src.ts: -------------------------------------------------------------------------------- 1 | const x: X; 2 | Observable.empty(); 3 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/null-and-undefined-type-annotations.src.ts: -------------------------------------------------------------------------------- 1 | let x: null; 2 | let y: undefined; -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/type-alias-object-without-annotation.src.ts: -------------------------------------------------------------------------------- 1 | type foo = {bar: string, baz}; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/class-multiple-implements.src.ts: -------------------------------------------------------------------------------- 1 | class a implements b implements c {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/interface-empty-extends.src.ts: -------------------------------------------------------------------------------- 1 | interface Foo extends { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/conditional-infer.src.ts: -------------------------------------------------------------------------------- 1 | type Element = T extends (infer U)[] ? U : T; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/conditional-with-null.src.ts: -------------------------------------------------------------------------------- 1 | let x: number extends string ? boolean : null; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/index-signature-without-type.src.ts: -------------------------------------------------------------------------------- 1 | type foo = { 2 | [a: string]; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/intersection-type.src.ts: -------------------------------------------------------------------------------- 1 | type LinkedList = T & { next: LinkedList }; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/mapped-readonly-minus.src.ts: -------------------------------------------------------------------------------- 1 | let map: { -readonly [P in string]-?: number }; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/mapped-readonly-plus.src.ts: -------------------------------------------------------------------------------- 1 | let map: { +readonly [P in string]+?: number; }; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/basic-in-binary-expression.src.js: -------------------------------------------------------------------------------- 1 | (a => ({})) + 1; 2 | ((a => ({})) + 1); 3 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/arrowFunctions/error-strict-param-no-paren-arguments.src.js: -------------------------------------------------------------------------------- 1 | "use strict"; arguments => 42; -------------------------------------------------------------------------------- /tests/fixtures/javascript/blockBindings/let-in-switchcase.src.js: -------------------------------------------------------------------------------- 1 | switch (answer) { case 42: let t = 42; break; } 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/defaultParams/class-method.src.js: -------------------------------------------------------------------------------- 1 | class A { 2 | foo(bar='baz') { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/defaults-object-longform-all.src.js: -------------------------------------------------------------------------------- 1 | var {x: x = 10, y: y = 10, z: z = 10} = a; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/param-defaults-object-nested.src.js: -------------------------------------------------------------------------------- 1 | function a({x = 10, y: { z = 10 }}) {}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/experimentalAsyncIteration/async-generators.src.js: -------------------------------------------------------------------------------- 1 | async function* foo() { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/experimentalObjectRestSpread/destructuring-assign-mirror.src.js: -------------------------------------------------------------------------------- 1 | ({a, ...b} = {a, ...b}) 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/forOf/for-of-with-var-and-no-braces.src.js: -------------------------------------------------------------------------------- 1 | for (var x of foo) 2 | doSomething(); 3 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/error-function.src.js: -------------------------------------------------------------------------------- 1 | function x() { 2 | export default friends; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/export-from-named-as-specifiers.src.js: -------------------------------------------------------------------------------- 1 | export {foo as default, bar} from "foo"; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/import-default-and-namespace-specifiers.src.js: -------------------------------------------------------------------------------- 1 | import foo, * as bar from "foo"; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/invalid-import-named-after-namespace.src.js: -------------------------------------------------------------------------------- 1 | import * as foo, {bar} from "foo"; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/invalid-import-namespace-after-named.src.js: -------------------------------------------------------------------------------- 1 | import {bar}, * as foo from "foo"; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/newTarget/invalid-unknown-property.src.js: -------------------------------------------------------------------------------- 1 | var f = function() { new.unknown_property; } 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/objectLiteralShorthandMethods/simple-method.src.js: -------------------------------------------------------------------------------- 1 | x = { 2 | method() { 3 | } 4 | };; -------------------------------------------------------------------------------- /tests/fixtures/jsx/trailing-spread-operator-attribute.src.js: -------------------------------------------------------------------------------- 1 |
; -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/arrow-function-with-type-parameters.src.ts: -------------------------------------------------------------------------------- 1 | (b: X): X => { 2 | return b; 3 | } -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-implements-generic.src.ts: -------------------------------------------------------------------------------- 1 | class Foo implements Bar { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/export-default-class-with-generic.src.ts: -------------------------------------------------------------------------------- 1 | export default class { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/import-type.src.ts: -------------------------------------------------------------------------------- 1 | type A = typeof import('A'); 2 | type B = import("B").X; 3 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/type-assertion-arrow-function.src.ts: -------------------------------------------------------------------------------- 1 | var asserted2 = ((n) => { return n; }); 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/var-with-type.src.ts: -------------------------------------------------------------------------------- 1 | var name:string = "Nicholas"; 2 | var foo: string = "Bar"; 3 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/interface-multiple-extends.src.ts: -------------------------------------------------------------------------------- 1 | interface foo extends bar extends baz {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/comments/jsx-text-with-url.src.js: -------------------------------------------------------------------------------- 1 | const link = (
http://example.com); 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-defaultParams/param-object-wrapped.src.js: -------------------------------------------------------------------------------- 1 | ({f: function({x} = {x: 10}) {}}); -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-spread/error-complex-destructured-spread-first.src.js: -------------------------------------------------------------------------------- 1 | [...c, { a, b }] = d; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/defaults-array-longform-nested-multi.src.js: -------------------------------------------------------------------------------- 1 | var {x: x, y: y, z: { a: a = 10} } = b; -------------------------------------------------------------------------------- /tests/fixtures/javascript/directives/function-non-strict.src.js: -------------------------------------------------------------------------------- 1 | function foo () { 2 | "use smth" 3 | 1+1; 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/experimentalObjectRestSpread/invalid-rest-trailing-comma.src.js: -------------------------------------------------------------------------------- 1 | var { x, y, ...z, } = foo; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/forOf/for-of-with-var-and-braces.src.js: -------------------------------------------------------------------------------- 1 | for (var x of foo) { 2 | doSomething(); 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/forOf/invalid-for-of-with-let-and-no-braces.src.js: -------------------------------------------------------------------------------- 1 | for (let x of foo) 2 | doSomething(); 3 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/objectLiteralComputedProperties/computed-getter-and-setter.src.js: -------------------------------------------------------------------------------- 1 | ({get [x]() {}, set [x](v) {}}); -------------------------------------------------------------------------------- /tests/fixtures/javascript/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.src.js: -------------------------------------------------------------------------------- 1 | ({[x]}); 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/objectLiteralShorthandMethods/invalid-method-no-braces.src.js: -------------------------------------------------------------------------------- 1 | x = { 2 | method() 42 3 | };; -------------------------------------------------------------------------------- /tests/fixtures/javascript/restParams/class-constructor.src.js: -------------------------------------------------------------------------------- 1 | class A { 2 | constructor(...foo) { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-generic-method-default.src.ts: -------------------------------------------------------------------------------- 1 | class Foo { 2 | getBar() {} 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/declare-class-with-optional-method.src.ts: -------------------------------------------------------------------------------- 1 | declare class Foo { 2 | bar?(): any; 3 | } -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/destructuring-assignment-property.src.ts: -------------------------------------------------------------------------------- 1 | function Foo({ foo = [] } = bar) { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/export-named-class-with-multiple-generics.src.ts: -------------------------------------------------------------------------------- 1 | export class Foo { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/export-type-function-declaration.src.ts: -------------------------------------------------------------------------------- 1 | export type TestCallback = (a: number) => void; -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/function-with-await.src.ts: -------------------------------------------------------------------------------- 1 | async function hope(future) { 2 | await future; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/function-with-type-parameters-that-have-comments.src.ts: -------------------------------------------------------------------------------- 1 | function compare() {} -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/function-with-type-parameters.src.ts: -------------------------------------------------------------------------------- 1 | function a(b: X): X { 2 | return b; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/interface-with-extends-member-expression.src.ts: -------------------------------------------------------------------------------- 1 | interface foo extends bar.baz { 2 | } 3 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/class-one-method-super.src.js: -------------------------------------------------------------------------------- 1 | class A { 2 | a(){ 3 | super(); 4 | } 5 | }; 6 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/class-two-methods-computed-constructor.src.js: -------------------------------------------------------------------------------- 1 | class A {"constructor"(){} ["constructor"](){}}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/defaultParams/class-constructor.src.js: -------------------------------------------------------------------------------- 1 | class A { 2 | constructor(foo='bar') { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src.js: -------------------------------------------------------------------------------- 1 | ({foo: y, a:{bar: x}}) => x; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/class-method-params-array.src.js: -------------------------------------------------------------------------------- 1 | class A { 2 | foo([bar, baz]) { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/experimentalObjectRestSpread/function-parameter-object-spread.src.js: -------------------------------------------------------------------------------- 1 | function foo({...bar}) { } 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/experimentalObjectRestSpread/object-rest.src.js: -------------------------------------------------------------------------------- 1 | var { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 }; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/experimentalOptionalCatchBinding/optional-catch-binding-finally.src.js: -------------------------------------------------------------------------------- 1 | try {} catch {} finally {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/forOf/invalid-for-of-with-const-and-no-braces.src.js: -------------------------------------------------------------------------------- 1 | for (const x of foo) 2 | doSomething(); 3 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/labels/label-break.src.js: -------------------------------------------------------------------------------- 1 | loop1: 2 | while(true) { 3 | break loop1; 4 | break; 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/invalid-import-default-after-named-after-default.src.js: -------------------------------------------------------------------------------- 1 | import foo, {bar}, foo from "foo"; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/objectLiteralComputedProperties/standalone-expression-with-addition.src.js: -------------------------------------------------------------------------------- 1 | ({["x" + "y"]: 10}); 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/objectLiteralComputedProperties/standalone-expression-with-method.src.js: -------------------------------------------------------------------------------- 1 | ({[x]: function() {}}); 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/objectLiteralShorthandMethods/simple-method-named-get.src.js: -------------------------------------------------------------------------------- 1 | x = { 2 | get() { 3 | } 4 | };; -------------------------------------------------------------------------------- /tests/fixtures/javascript/objectLiteralShorthandMethods/simple-method-named-set.src.js: -------------------------------------------------------------------------------- 1 | x = { 2 | set() { 3 | } 4 | };; -------------------------------------------------------------------------------- /tests/fixtures/jsx/element-keyword-name.src.js: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /tests/fixtures/jsx/escape-patterns.src.js: -------------------------------------------------------------------------------- 1 | ; -------------------------------------------------------------------------------- /tests/fixtures/jsx/invalid-no-common-parent-with-comment.src.js: -------------------------------------------------------------------------------- 1 | var x =
one
/* intervening comment */
two
; -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-implements-generic-multiple.src.ts: -------------------------------------------------------------------------------- 1 | class Foo implements Bar { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-mixin-reference.src.ts: -------------------------------------------------------------------------------- 1 | function M>(Base: T) { 2 | } 3 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/export-default-class-with-multiple-generics.src.ts: -------------------------------------------------------------------------------- 1 | export default class { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/export-type-class-declaration.src.ts: -------------------------------------------------------------------------------- 1 | export type TestClassProps = { 2 | count: number 3 | }; -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/import-type-with-type-parameters-in-type-reference.src.ts: -------------------------------------------------------------------------------- 1 | type X = A>; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/interface-with-extends-type-parameters.src.ts: -------------------------------------------------------------------------------- 1 | interface Foo extends Bar { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/parenthesized-use-strict.src.ts: -------------------------------------------------------------------------------- 1 | // this should not be classed as a directive 2 | ("use strict"); -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/class-empty-extends-implements.src.ts: -------------------------------------------------------------------------------- 1 | class Foo extends implements Bar { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/class-extends-empty-implements.src.ts: -------------------------------------------------------------------------------- 1 | class Foo extends Bar implements { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/interface-property-export.src.ts: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | export a: string; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/interface-property-static.src.ts: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | static a: string; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/index-signature-readonly.src.ts: -------------------------------------------------------------------------------- 1 | type foo = { 2 | readonly [key: number]: number; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/this-type.src.ts: -------------------------------------------------------------------------------- 1 | class Message { 2 | clone(): this { 3 | return this; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring-and-arrowFunctions/param-defaults-object-nested.src.js: -------------------------------------------------------------------------------- 1 | ({x = 10, y: { z = 10 }}) => [x, z] -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/class-method-params-object.src.js: -------------------------------------------------------------------------------- 1 | class A { 2 | foo({bar, baz}) { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/directives/block.src.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | "use strict"; 3 | var a = 1; 4 | "use strict"; 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/experimentalObjectRestSpread/invalid-rest.src.js: -------------------------------------------------------------------------------- 1 | var { x, y, ...foo.bar } = { x: 1, y: 2, a: 3, b: 4 }; 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/objectLiteralComputedProperties/computed-addition-property.src.js: -------------------------------------------------------------------------------- 1 | var x = { 2 | [5 + 5]: foo 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/objectLiteralComputedProperties/computed-string-property.src.js: -------------------------------------------------------------------------------- 1 | var x = { 2 | ["hey"]: foo 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/objectLiteralComputedProperties/computed-variable-property.src.js: -------------------------------------------------------------------------------- 1 | var x = { 2 | [bar]: foo 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/templateStrings/expressions.src.js: -------------------------------------------------------------------------------- 1 | var a = 5; 2 | var b = 'Fred'; 3 | 4 | `Hello ${b}. a + 5 = ${a + 5}`; -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/call-signatures.src.ts: -------------------------------------------------------------------------------- 1 | type foo = { 2 | (a: string): string 3 | new(a: string): string 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-extends-generic-multiple.src.ts: -------------------------------------------------------------------------------- 1 | class Foo
extends Bar { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-readonly-property.src.ts: -------------------------------------------------------------------------------- 1 | class Foo { 2 | public readonly foo = 'string'; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/export-declare-named-enum.src.ts: -------------------------------------------------------------------------------- 1 | export declare enum Foo { 2 | foo = 1, 3 | bar 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/function-with-types.src.ts: -------------------------------------------------------------------------------- 1 | function message(name:string):string { 2 | return name; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/type-guard-in-interface.src.ts: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | isString(node: any): node is string; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/var-with-definite-assignment.src.ts: -------------------------------------------------------------------------------- 1 | const x!: string; 2 | var y!: number; 3 | let z!: object; 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/interface-property-private.src.ts: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | private b: string; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/interface-property-protected.src.ts: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | protected a: string; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/interface-property-public.src.ts: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | public a: string; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/namespaces-and-modules/shorthand-ambient-module-declaration.src.ts: -------------------------------------------------------------------------------- 1 | declare module "hot-new-module"; 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/conditional-infer-simple.src.ts: -------------------------------------------------------------------------------- 1 | type Foo = T extends { a: infer U, b: infer U } ? U : never; 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | coverage 3 | node_modules 4 | npm-debug.log 5 | _test.js 6 | .DS_Store 7 | .vscode 8 | .idea 9 | dist 10 | -------------------------------------------------------------------------------- /tests/fixtures/comments/jsx-with-operators.src.js: -------------------------------------------------------------------------------- 1 | if (1 > 3); 3 | const foo = // 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/comments/surrounding-call-comments.src.js: -------------------------------------------------------------------------------- 1 | function a() { 2 | /* before */ 3 | foo(); 4 | /* after */ 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/comments/surrounding-while-loop-comments.src.js: -------------------------------------------------------------------------------- 1 | function f() { /* infinite */ while (true) { } /* bar */ var each; } 2 | -------------------------------------------------------------------------------- /tests/fixtures/comments/switch-no-default-comment.src.js: -------------------------------------------------------------------------------- 1 | switch (a) { 2 | case 1: 3 | break; 4 | //no default 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/comments/template-string-block.src.js: -------------------------------------------------------------------------------- 1 | `${name}`; 2 | { 3 | /* TODO comment comment comment */ 4 | 1 + 1; 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/labels/label-continue.src.js: -------------------------------------------------------------------------------- 1 | loop1: 2 | while(true) { 3 | continue loop1; 4 | continue; 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/modules/error-strict.src.js: -------------------------------------------------------------------------------- 1 | import house from "house"; 2 | 3 | with (house) { 4 | console.log(roof); 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/objectLiteralComputedProperties/invalid-computed-variable-property.src.js: -------------------------------------------------------------------------------- 1 | var x = { 2 | [bar] 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/objectLiteralShorthandMethods/simple-method-with-string-name.src.js: -------------------------------------------------------------------------------- 1 | x = { 2 | "method"() { 3 | } 4 | };; -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-method.src.ts: -------------------------------------------------------------------------------- 1 | class C { 2 | foo(): number { } 3 | bar() { } 4 | baz() {} 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-optional-computed-property.src.ts: -------------------------------------------------------------------------------- 1 | class X { 2 | private ['foo']? = undefined; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-optional-property-undefined.src.ts: -------------------------------------------------------------------------------- 1 | class X { 2 | private foo? = undefined; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/typed-method-signature.src.ts: -------------------------------------------------------------------------------- 1 | type Foo = { 2 | h(bar: string): void; 3 | g(bar: T): T; 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/enum-with-keywords.src.ts: -------------------------------------------------------------------------------- 1 | export private public protected static readonly abstract async enum X {} -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/index-signature-parameters.src.ts: -------------------------------------------------------------------------------- 1 | type foo = { 2 | [a: string, b: string]: string; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/interface-method-export.src.ts: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | export g(bar: string): void; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/interface-method-public.src.ts: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | public g(bar: string): void; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/interface-method-static.src.ts: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | static g(bar: string): void; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/interface-property-with-default-value.src.ts: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | bar: string = 'a'; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/nested-types.src.ts: -------------------------------------------------------------------------------- 1 | type Foo = [number, string?, boolean?] | [{}, [number?] | null & boolean[]] & {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/comments/jsx-comment-after-jsx.src.js: -------------------------------------------------------------------------------- 1 | const pure = () => { 2 | return ( 3 | // Foo 4 | ); 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/comments/jsx-with-greather-than.src.js: -------------------------------------------------------------------------------- 1 | if (1 >/* Test */2) { 2 | test( 2 >> 3); 3 | const foo = // 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/comments/surrounding-return-comments.src.js: -------------------------------------------------------------------------------- 1 | function a() { 2 | /* before */ 3 | return; 4 | /* after */ 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/comments/surrounding-throw-comments.src.js: -------------------------------------------------------------------------------- 1 | function a() { 2 | /* before */ 3 | throw 55; 4 | /* after */ 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/basics/do-while-statements.src.js: -------------------------------------------------------------------------------- 1 | do; while(1); 2 | 3 | var i = 0; 4 | do { 5 | i += 1; 6 | } while (i < 5); 7 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/class-two-static-methods-named-constructor.src.js: -------------------------------------------------------------------------------- 1 | class A {static constructor(){} static constructor(){}}; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/class-constructor-params-array.src.js: -------------------------------------------------------------------------------- 1 | class A { 2 | consturctor([foo, bar]) { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/class-constructor-params-object.src.js: -------------------------------------------------------------------------------- 1 | class A { 2 | consturctor({foo, bar}) { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/class-method-params-defaults-array.src.js: -------------------------------------------------------------------------------- 1 | class A { 2 | foo([bar=3, baz=4]) { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/class-method-params-defaults-object.src.js: -------------------------------------------------------------------------------- 1 | class A { 2 | foo({bar=3, baz=3}) { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/forOf/for-of-with-function-initializer.src.js: -------------------------------------------------------------------------------- 1 | for (var i = function() { return 10 in [] } of list) process(x); 2 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/objectLiteralShorthandMethods/simple-method-with-argument.src.js: -------------------------------------------------------------------------------- 1 | x = { 2 | method(test) { 3 | 4 | } 5 | };; -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/directive-in-module.src.ts: -------------------------------------------------------------------------------- 1 | module foo { 2 | "use strict"; 3 | var a = 1; 4 | "use strict"; 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/export-declare-const-named-enum.src.ts: -------------------------------------------------------------------------------- 1 | export declare const enum Foo { 2 | foo = 1, 3 | bar 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/interface-with-method.src.ts: -------------------------------------------------------------------------------- 1 | interface test { 2 | h(bar: string): void; 3 | g(bar: T): T; 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/type-alias-declaration-with-constrained-type-parameter.src.ts: -------------------------------------------------------------------------------- 1 | type Result = Success | Failure -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/interface-method-private.src.ts: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | private g(bar: string): void; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/interface-method-protected.src.ts: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | protected g(bar: string): void; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /tests/fixtures/comments/surrounding-debugger-comments.src.js: -------------------------------------------------------------------------------- 1 | function a() { 2 | /* before */ 3 | debugger; 4 | /* after */ 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/classes/class-static-methods-and-accessor-properties.src.js: -------------------------------------------------------------------------------- 1 | class A {static a(){} static get a(){} static set a(b){} }; -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/directive-in-namespace.src.ts: -------------------------------------------------------------------------------- 1 | namespace foo { 2 | "use strict"; 3 | var a = 1; 4 | "use strict"; 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/function-with-object-type-without-annotation.src.ts: -------------------------------------------------------------------------------- 1 | function foo({bar, baz}: {bar: string, baz}) { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/type-guard-in-function.src.ts: -------------------------------------------------------------------------------- 1 | function isString(x: any): x is string { 2 | return typeof x === 'string' 3 | } -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/interface-index-signature-export.src.ts: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | export [baz: string]: string; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/interface-index-signature-private.src.ts: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | private [baz: string]: string; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/interface-index-signature-public.src.ts: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | public [baz: string]: string; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/interface-index-signature-static.src.ts: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | static [baz: string]: string; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /tests/fixtures/comments/jsx-comment-after-self-closing-jsx.src.js: -------------------------------------------------------------------------------- 1 | const pure = () => { 2 | return ( 3 | // Foo 4 | ); 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/generators/async-generator-method.src.js: -------------------------------------------------------------------------------- 1 | class C { 2 | async * f() { 3 | const x = yield* g(); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/objectLiteralShorthandMethods/method-property.src.js: -------------------------------------------------------------------------------- 1 | var x = { 2 | foo() { 3 | return bar; 4 | } 5 | }; 6 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/call-signatures-with-generics.src.ts: -------------------------------------------------------------------------------- 1 | type foo = { 2 | (a: string): string 3 | new(a: string): string 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/function-with-type-parameters-with-constraint.src.ts: -------------------------------------------------------------------------------- 1 | function a(b: X): X { 2 | return b; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/type-reference-comments.src.ts: -------------------------------------------------------------------------------- 1 | class AudioBufferList { 2 | mBuffers: interop.Reference; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/typed-this.src.ts: -------------------------------------------------------------------------------- 1 | interface UIElement { 2 | addClickListener(onclick: (this: void, e: Event) => void): void; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.src.ts: -------------------------------------------------------------------------------- 1 | class B { 2 | @foo x; 3 | @bar 4 | y; 5 | } -------------------------------------------------------------------------------- /tests/fixtures/typescript/errorRecovery/interface-index-signature-protected.src.ts: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | protected [baz: string]: string; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/callExpression/mixed-expression.src.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | (function () { 3 | this.call({}, []) 4 | })([]); 5 | })({}); 6 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/class-constructor-params-defaults-array.src.js: -------------------------------------------------------------------------------- 1 | class A { 2 | consturctor([foo=3, bar=4]) { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/class-constructor-params-defaults-object.src.js: -------------------------------------------------------------------------------- 1 | class A { 2 | consturctor({foo=3, bar=4}) { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/abstract-class-with-abstract-constructor.src.ts: -------------------------------------------------------------------------------- 1 | export abstract class AbstractSocket { 2 | abstract constructor(); 3 | } -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/abstract-class-with-abstract-properties.src.ts: -------------------------------------------------------------------------------- 1 | abstract class Foo { 2 | abstract bar; 3 | abstract baz = 3; 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-extends-and-implements.src.ts: -------------------------------------------------------------------------------- 1 | class ClassWithParentAndInterface extends MyOtherClass implements MyInterface {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-implements-and-extends.src.ts: -------------------------------------------------------------------------------- 1 | class ClassWithParentAndInterface implements MyInterface extends MyOtherClass {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-optional-methods.src.ts: -------------------------------------------------------------------------------- 1 | class Foo { 2 | foo?(); 3 | bar?(): string; 4 | private baz?(): string; 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-optional-properties.src.ts: -------------------------------------------------------------------------------- 1 | class Foo { 2 | foo?; 3 | bar? : string; 4 | private baz? : string; 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/function-with-object-type-with-optional-properties.src.ts: -------------------------------------------------------------------------------- 1 | function foo({bar, baz}: {bar?: string, baz?}) { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/decorators/class-decorators/class-decorator-factory.src.ts: -------------------------------------------------------------------------------- 1 | @Component({ 2 | selector: 'foo', 3 | }) 4 | class FooComponent {} -------------------------------------------------------------------------------- /tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.src.ts: -------------------------------------------------------------------------------- 1 | class D { 2 | @Foo 3 | static staticMethod() {} 4 | } 5 | -------------------------------------------------------------------------------- /.codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | status: 3 | patch: 4 | default: 5 | target: 90% 6 | project: 7 | default: 8 | target: auto 9 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/objectLiteralShorthandMethods/string-name-method-property.src.js: -------------------------------------------------------------------------------- 1 | var x = { 2 | "foo"() { 3 | return bar; 4 | } 5 | }; 6 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/templateStrings/tagged-template-string.src.js: -------------------------------------------------------------------------------- 1 | function tag() { 2 | console.log(arguments); 3 | } 4 | tag`a is ${a} while b is ${b}.`; -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/abstract-class-with-optional-method.src.ts: -------------------------------------------------------------------------------- 1 | export abstract class AbstractSocket { 2 | createSocket?(): Promise; 3 | } -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-export-parameter-properties.src.ts: -------------------------------------------------------------------------------- 1 | class Foo { 2 | constructor(export a: string) { 3 | 4 | } 5 | } 6 | 7 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/non-null-assertion-operator.src.ts: -------------------------------------------------------------------------------- 1 | function processEntity(e?: Entity) { 2 | validateEntity(e); 3 | let s = e!.name; 4 | } -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/type-guard-in-arrow-function.src.ts: -------------------------------------------------------------------------------- 1 | const isString = (x: any): x is string => { 2 | return typeof x === 'string' 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.src.ts: -------------------------------------------------------------------------------- 1 | class A { 2 | @onlyRead 3 | instanceMethod() {} 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/namespaces-and-modules/ambient-module-declaration-with-import.src.ts: -------------------------------------------------------------------------------- 1 | declare module "i-use-things" { 2 | import fs from 'fs'; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/destructured-array-catch.src.js: -------------------------------------------------------------------------------- 1 | function x({a}) { 2 | try { 3 | var {b} = a; 4 | } 5 | catch([stack]) { 6 | } 7 | }; -------------------------------------------------------------------------------- /tests/fixtures/javascript/destructuring/destructured-object-catch.src.js: -------------------------------------------------------------------------------- 1 | function x({a}) { 2 | try { 3 | var {b} = a; 4 | } 5 | catch({stack}) { 6 | } 7 | }; -------------------------------------------------------------------------------- /tests/fixtures/javascript/experimentalAsyncIteration/async-iterator.src.js: -------------------------------------------------------------------------------- 1 | async function foo() { 2 | for await (const item of items) { 3 | 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/objectLiteralDuplicateProperties/strict-duplicate-properties.src.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var x = { 4 | y: 'first', 5 | y: 'second' 6 | }; -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/abstract-class-with-abstract-readonly-property.src.ts: -------------------------------------------------------------------------------- 1 | abstract class Foo { 2 | public abstract readonly foo = 'string'; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-constructor-and-type-parameters.src.ts: -------------------------------------------------------------------------------- 1 | class C { 2 | constructor() { } 3 | 4 | ['constructor']() { } 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-static-parameter-properties.src.ts: -------------------------------------------------------------------------------- 1 | class Foo { 2 | constructor(static a: string) { 3 | 4 | } 5 | } 6 | 7 | 8 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.src.ts: -------------------------------------------------------------------------------- 1 | interface Test { 2 | new (public x, private y); 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.src.ts: -------------------------------------------------------------------------------- 1 | class P { 2 | @hidden 3 | get z() { return this._z; } 4 | } -------------------------------------------------------------------------------- /tests/fixtures/javascript/spread/complex-spread.src.js: -------------------------------------------------------------------------------- 1 | ({x: { ka, ...nested }, y: other, f: { a: [{ ...nested2 }, ...y], b: { z, ...c }, ...rest2 }, ...rest} = complex); 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/abstract-class-with-abstract-method.src.ts: -------------------------------------------------------------------------------- 1 | export abstract class AbstractSocket { 2 | abstract createSocket(): Promise; 3 | } -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-constructor-and-modifier.src.ts: -------------------------------------------------------------------------------- 1 | class C { 2 | protected constructor() { } 3 | 4 | public ['constructor']() { } 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-constructor-and-return-type.src.ts: -------------------------------------------------------------------------------- 1 | class C { 2 | constructor(): number { } 3 | 4 | ['constructor'](): number { } 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-property-function.src.ts: -------------------------------------------------------------------------------- 1 | class Foo { 2 | foo: () => boolean = (): boolean => true; 3 | bar: string = () => test; 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.src.ts: -------------------------------------------------------------------------------- 1 | class C { 2 | @Foo(false) 3 | static staticMethod() {} 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.src.ts: -------------------------------------------------------------------------------- 1 | class C { 2 | @baz static a; 3 | @qux 4 | static b; 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/comments/jsx-block-comment.src.js: -------------------------------------------------------------------------------- 1 | const pure = () => { 2 | return ( 3 | 4 | {/*COMMENT*/} 5 | 6 | ); 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/comments/switch-fallthrough-comment.src.js: -------------------------------------------------------------------------------- 1 | switch(foo) { 2 | // foo 3 | case 1: 4 | // falls through 5 | case 2: 6 | doIt(); 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/basics/identifiers-double-underscore.src.js: -------------------------------------------------------------------------------- 1 | var __test = 'ff'; 2 | 3 | class __Foo { 4 | 5 | } 6 | 7 | function __Bar() { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/objectLiteralDuplicateProperties/strict-duplicate-string-properties.src.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var x = { 4 | "y": "first", 5 | "y": "second" 6 | }; -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-property-values.src.ts: -------------------------------------------------------------------------------- 1 | class Foo { 2 | a = 2; 3 | b = {}; 4 | c = []; 5 | d = ""; 6 | e = new Array([{}, [], 2]); 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/interface-with-jsdoc.src.ts: -------------------------------------------------------------------------------- 1 | interface Test { 2 | /** 3 | * Comment Line 1 4 | * @baz bar 5 | */ 6 | foo(bar); 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/interface-with-optional-properties.src.ts: -------------------------------------------------------------------------------- 1 | interface test { 2 | foo?; 3 | bar?: string; 4 | baz?(foo, bar?: string, baz?); 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.src.ts: -------------------------------------------------------------------------------- 1 | class B { 2 | @onlyRead(false) 3 | instanceMethod() {} 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src.ts: -------------------------------------------------------------------------------- 1 | class Foo { 2 | bar(@special(true) baz: number) {} 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/function-with-types-assignation.src.ts: -------------------------------------------------------------------------------- 1 | function message(name:string, age:number = 100, ...args:Array):string { 2 | return name; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/object-with-escaped-properties.src.ts: -------------------------------------------------------------------------------- 1 | ({ '__': null }); 2 | 3 | ({ '__'() {} }); 4 | 5 | ({ ['__']: null }); 6 | 7 | class X { '__' = null } 8 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src.ts: -------------------------------------------------------------------------------- 1 | class StaticFoo { 2 | static bar(@special(true) baz: number) {} 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.src.ts: -------------------------------------------------------------------------------- 1 | declare namespace d3 { 2 | export function select(selector: string): Selection; 3 | } -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/async-function-with-var-declaration.src.ts: -------------------------------------------------------------------------------- 1 | async function test() { 2 | var foo = 'foo'; 3 | let bar = 'bar'; 4 | const fooBar = 'fooBar'; 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src.ts: -------------------------------------------------------------------------------- 1 | class Point { 2 | @configurable(false) 3 | get x() { return this._x; } 4 | } -------------------------------------------------------------------------------- /tests/fixtures/javascript/experimentalObjectRestSpread/shorthand-properties.src.js: -------------------------------------------------------------------------------- 1 | var foo, 2 | get, 3 | set; 4 | 5 | var x = { 6 | foo, 7 | get, 8 | ...set 9 | }; 10 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/experimentalObjectRestSpread/two-spread.src.js: -------------------------------------------------------------------------------- 1 | var foo, 2 | get, 3 | set; 4 | 5 | var x = { 6 | foo: foo, 7 | ...get, 8 | ...set 9 | }; 10 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/objectLiteralDuplicateProperties/error-proto-property.src.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var proto = {}; 4 | 5 | var x = { 6 | __proto__: proto, 7 | __proto__: proto 8 | }; -------------------------------------------------------------------------------- /tests/fixtures/semanticInfo/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "commonjs", 5 | "strict": true, 6 | "esModuleInterop": true 7 | } 8 | } -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-two-methods-computed-constructor.src.ts: -------------------------------------------------------------------------------- 1 | class A { 2 | "constructor"(): number { 3 | } 4 | 5 | ["constructor"](): number { 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.src.ts: -------------------------------------------------------------------------------- 1 | class Other { 2 | @foo({ baz: true }) 3 | static get bar() { return this._bar; } 4 | } -------------------------------------------------------------------------------- /tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.src.ts: -------------------------------------------------------------------------------- 1 | class User { 2 | @adminonly 3 | static set y(a) { 4 | this._y = a; 5 | } 6 | } -------------------------------------------------------------------------------- /tests/fixtures/javascript/experimentalObjectRestSpread/single-spread.src.js: -------------------------------------------------------------------------------- 1 | var foo, 2 | get, 3 | set; 4 | 5 | var x = { 6 | foo: foo, 7 | get: get, 8 | ...set 9 | }; 10 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/objectLiteralShorthandProperties/shorthand-properties.src.js: -------------------------------------------------------------------------------- 1 | var foo, 2 | get, 3 | set; 4 | 5 | var x = { 6 | foo, 7 | get, 8 | set 9 | }; 10 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-readonly-parameter-properties.src.ts: -------------------------------------------------------------------------------- 1 | class Foo { 2 | constructor(readonly firstName: string, 3 | readonly lastName: string = 'Smith') {} 4 | } -------------------------------------------------------------------------------- /tests/fixtures/comments/jsx-text-with-multiline-non-comment.src.js: -------------------------------------------------------------------------------- 1 | const pure = () => { 2 | return ( 3 | 4 | /** 5 | * test 6 | */ 7 | 8 | ); 9 | } 10 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/basics/and-operator-array-object.src.js: -------------------------------------------------------------------------------- 1 | var v = {} && {} && [] && "" && ("" && {}); 2 | var x = [] && [] && {} && "" && ("" && []); 3 | var z = [] && []; 4 | var y = {} && {}; 5 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/basics/or-operator-array-object.src.js: -------------------------------------------------------------------------------- 1 | var v = {} || {} || [] || "" || ("" || {}); 2 | var x = [] || [] || {} || "" || ("" || []); 3 | var z = [] || []; 4 | var y = {} || {}; 5 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/experimentalObjectRestSpread/property-spread.src.js: -------------------------------------------------------------------------------- 1 | var foo, 2 | get, 3 | set; 4 | 5 | var x = { 6 | foo: foo, 7 | get: get, 8 | ...set.foo 9 | }; 10 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/objectLiteralDuplicateProperties/error-proto-string-property.src.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var proto = {}; 4 | 5 | var x = { 6 | "__proto__": proto, 7 | "__proto__": proto 8 | }; -------------------------------------------------------------------------------- /tests/fixtures/javascript/templateStrings/multi-line-template-string.src.js: -------------------------------------------------------------------------------- 1 | `The last man on Earth 2 | sat alone in a room. 3 | There was 4 | a knock 5 | on the 6 | door...`; -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/destructuring-assignment-nested.src.ts: -------------------------------------------------------------------------------- 1 | ({ foo: { bar: { baz: [a, { foo: [x] = [3] } = { foo: [2]}] = [] } = {} } = { } } = { foo: { bar: { baz: [2, { foo: [3] }] } }}); 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/namespaces-and-modules/global-module-declaration.src.ts: -------------------------------------------------------------------------------- 1 | declare global { 2 | declare module global { 3 | 4 | } 5 | declare namespace global { 6 | 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/fixtures/comments/jsdoc-comment.src.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This is a function. 3 | * @param {String} bar some string 4 | * @returns {String} returns bar 5 | */ 6 | function foo(bar) { 7 | return bar; 8 | } 9 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/experimentalObjectRestSpread/shorthand-method-args.src.js: -------------------------------------------------------------------------------- 1 | ({ 2 | initialize({someVar, otherVar, ...options}) { 3 | // ... do some stuff with options ... 4 | } 5 | }); 6 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/experimentalObjectRestSpread/shorthand-methods.src.js: -------------------------------------------------------------------------------- 1 | var x = { 2 | initialize({someVar, otherVar, ...options}) { 3 | // ... do some stuff with options ... 4 | } 5 | }; -------------------------------------------------------------------------------- /tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.src.ts: -------------------------------------------------------------------------------- 1 | class SomeComponent { 2 | @Input() data; 3 | @Output() 4 | click = new EventEmitter(); 5 | } -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/conditional-infer-nested.src.ts: -------------------------------------------------------------------------------- 1 | type Unpacked = 2 | T extends (infer U)[] ? U : 3 | T extends infer U ? U : 4 | T extends Promise ? U : 5 | T; 6 | -------------------------------------------------------------------------------- /tests/fixtures/javascript/forIn/for-in-bare-nonstrict.src.js: -------------------------------------------------------------------------------- 1 | var effects = 0; 2 | var iterations = 0; 3 | var stored; 4 | for (var a = (++effects, -1) in stored = a, {a: 0, b: 1, c: 2}) { 5 | ++iterations; 6 | } 7 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/type-parameters-comments.src.ts: -------------------------------------------------------------------------------- 1 | foo< /* comment 1 */ A /* comment 2 */ >(); 2 | function bar< /* aaa */ A /* bbb */ >() { } 3 | function baz< /* aaa */ A /* bbb */ = Foo >() { } 4 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.src.ts: -------------------------------------------------------------------------------- 1 | class Greeter { 2 | greet(@required name: string) { 3 | return "Hello " + name + "!"; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.src.ts: -------------------------------------------------------------------------------- 1 | class A { 2 | @configurable(true) static prop1; 3 | 4 | @configurable(false) 5 | static prop2; 6 | } -------------------------------------------------------------------------------- /tests/fixtures/comments/jsx-tag-comments.src.js: -------------------------------------------------------------------------------- 1 | const pure = () => { 2 | return ( 3 | 7 | 8 | ); 9 | } 10 | 11 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/function-overloads.src.ts: -------------------------------------------------------------------------------- 1 | export function f(x: number): number; 2 | export function f(x: string): string; 3 | export function f(x: string | number): string | number { 4 | return x; 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/namespaces-and-modules/module-with-default-exports.src.ts: -------------------------------------------------------------------------------- 1 | module "foo" { 2 | export default class C { 3 | method(): C {}; 4 | } 5 | export default function bar() {} 6 | } 7 | 8 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | quote_type = single 11 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.src.ts: -------------------------------------------------------------------------------- 1 | class Service { 2 | constructor(@Inject(APP_CONFIG) config: AppConfig) { 3 | this.title = config.title; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.src.ts: -------------------------------------------------------------------------------- 1 | class StaticGreeter { 2 | static greet(@required name: string) { 3 | return "Hello " + name + "!"; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/comments/export-default-anonymous-class.src.js: -------------------------------------------------------------------------------- 1 | /** 2 | * this is anonymous class. 3 | */ 4 | export default class { 5 | /** 6 | * this is method1. 7 | */ 8 | method1(){ 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/union-intersection.src.ts: -------------------------------------------------------------------------------- 1 | let union: number | null | undefined; 2 | let intersection: number & string; 3 | let precedence1: number | string & boolean; 4 | let precedence2: number & string | boolean; 5 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/type-guard-in-method.src.ts: -------------------------------------------------------------------------------- 1 | class Foo { 2 | isBar(): this is string { 3 | return this instanceof Foo; 4 | } 5 | isBaz = (): this is string => { 6 | return this instanceof Foo; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/fixtures/comments/switch-no-default-comment-in-function.src.js: -------------------------------------------------------------------------------- 1 | function bar(a) { 2 | switch (a) { 3 | case 2: 4 | break; 5 | case 1: 6 | break; 7 | //no default 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /tests/fixtures/comments/switch-fallthrough-comment-in-function.src.js: -------------------------------------------------------------------------------- 1 | function bar(foo) { 2 | switch(foo) { 3 | // foo 4 | case 1: 5 | // falls through 6 | case 2: 7 | doIt(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /tests/fixtures/tsx/react-typed-props.src.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | type Props = { 3 | title: string 4 | } 5 | 6 | export default function App(props: Props) { 7 | return ( 8 |

9 | {props.title} 10 |

11 | ) 12 | } -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2017", 4 | "module": "commonjs", 5 | "declaration": true, 6 | "outDir": "./dist", 7 | "strict": true, 8 | "esModuleInterop": true 9 | }, 10 | "include": ["src"] 11 | } 12 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-public-parameter-properties.src.ts: -------------------------------------------------------------------------------- 1 | class Foo { 2 | constructor(public firstName: string, 3 | public readonly lastName: string, 4 | public age: number = 30, 5 | public readonly student: boolean = false) {} 6 | } -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-accessibility-modifiers.src.ts: -------------------------------------------------------------------------------- 1 | class Foo { 2 | private bar : string; 3 | public static baz : number; 4 | public getBar () { 5 | return this.bar; 6 | } 7 | protected setBar (bar : string) { 8 | this.bar = bar; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-private-parameter-properties.src.ts: -------------------------------------------------------------------------------- 1 | class Foo { 2 | constructor(private firstName: string, 3 | private readonly lastName: string, 4 | private age: number = 30, 5 | private readonly student: boolean = false) {} 6 | } -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/object-with-typed-methods.src.ts: -------------------------------------------------------------------------------- 1 | const foo = { 2 | "constructor"(): number { 3 | return 1 4 | }, 5 | foo(): number { 6 | return 1 7 | }, 8 | get a(): number { 9 | return 1 10 | }, 11 | set a(x: number): number { 12 | } 13 | }; 14 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-mixin.src.ts: -------------------------------------------------------------------------------- 1 | function M>(Base: T) { 2 | return class extends Base { } 3 | } 4 | 5 | class X extends M(C) implements I { } 6 | 7 | class C { } 8 | interface I { } 9 | type Constructor = new (...args: any[]) => T; 10 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/class-with-protected-parameter-properties.src.ts: -------------------------------------------------------------------------------- 1 | class Foo { 2 | constructor(protected firstName: string, 3 | protected readonly lastName: string, 4 | protected age: number = 30, 5 | protected readonly student: boolean = false) {} 6 | } -------------------------------------------------------------------------------- /tests/fixtures/javascript/directives/non-directive-string.src.js: -------------------------------------------------------------------------------- 1 | if (true) { 2 | "use strict" 3 | } 4 | 5 | switch (true) { 6 | case false: { 7 | "use strict" 8 | } 9 | default: { 10 | "use strict" 11 | } 12 | } 13 | 14 | while (true) { 15 | "use strict" 16 | } 17 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | **What version of TypeScript are you using?** 2 | 3 | **What version of `typescript-estree` are you using?** 4 | 5 | **What code were you trying to parse?** 6 | 7 | ```ts 8 | // Put your code here 9 | ``` 10 | 11 | **What did you expect to happen?** 12 | 13 | **What actually happened?** 14 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/namespaces-and-modules/nested-internal-module.src.ts: -------------------------------------------------------------------------------- 1 | module A { 2 | 3 | export var x = 'hello world' 4 | export class Point { 5 | constructor(public x: number, public y: number) { } 6 | } 7 | export module B { 8 | export interface Id { 9 | name: string; 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /tests/fixtures/javascript/directives/directive-in-class.src.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | class Foo { 4 | constructor () { 5 | "use strict"; 6 | } 7 | 8 | get foo () { 9 | "use strict"; 10 | } 11 | 12 | set foo (value) { 13 | "use strict"; 14 | } 15 | 16 | method () { 17 | "use strict"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/fixtures/comments/switch-no-default-comment-in-nested-functions.src.js: -------------------------------------------------------------------------------- 1 | module.exports = function(context) { 2 | 3 | function isConstant(node) { 4 | switch (node.type) { 5 | case "SequenceExpression": 6 | return isConstant(node.expressions[node.expressions.length - 1]); 7 | // no default 8 | } 9 | return false; 10 | } 11 | 12 | }; 13 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/basics/interface-with-all-property-types.src.ts: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | baa: number; 3 | bar?: number; 4 | [bax]: string; 5 | [baz]?: string; 6 | [eee: number]: string; 7 | [fff?: number]: string; 8 | doo(): void; 9 | doo?(a, b, c): void; 10 | [loo]?(a, b, c): void; 11 | boo(a, b, c): void; 12 | new (a, b?): string; 13 | new (a, b?): string; 14 | } 15 | 16 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | testEnvironment: 'node', 5 | transform: { 6 | '^.+\\.tsx?$': 'ts-jest' 7 | }, 8 | testRegex: './tests/(lib/.*\\.(jsx?|tsx?)|ast-alignment/spec\\.ts)$', 9 | collectCoverage: false, 10 | collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}'], 11 | moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], 12 | coverageReporters: ['text-summary', 'lcov'] 13 | }; 14 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | cache: 3 | yarn: true 4 | directories: 5 | - node_modules 6 | notifications: 7 | email: false 8 | node_js: 9 | - '11' 10 | - '10' 11 | - '9' 12 | - '8' 13 | - '6' 14 | install: 15 | - yarn --ignore-engines 16 | script: 17 | - commitlint-travis 18 | - yarn check-format 19 | - yarn test 20 | - yarn build 21 | - yarn global add codecov 22 | after_success: 23 | - codecov 24 | - yarn travis-deploy-once "yarn semantic-release" 25 | branches: 26 | only: 27 | - master 28 | -------------------------------------------------------------------------------- /tests/jsx-known-issues.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Export the list to allow it to be used within both unit and AST comparison tests 3 | */ 4 | export default [ 5 | 'jsx/embedded-tags', // https://github.com/Microsoft/TypeScript/issues/7410 6 | 'jsx/namespaced-attribute-and-value-inserted', // https://github.com/Microsoft/TypeScript/issues/7411 7 | 'jsx/namespaced-name-and-attribute', // https://github.com/Microsoft/TypeScript/issues/7411 8 | 'jsx/invalid-namespace-value-with-dots' // https://github.com/Microsoft/TypeScript/issues/7411 9 | ]; 10 | -------------------------------------------------------------------------------- /tests/fixtures/typescript/types/this-type-expanded.src.ts: -------------------------------------------------------------------------------- 1 | class A { 2 | public a: number; 3 | 4 | public method(this: this): number { 5 | return this.a; 6 | } 7 | 8 | public method2(this: A): this { 9 | return this.a; 10 | } 11 | 12 | public method3(this: this): number { 13 | var fn = () => this.a; 14 | return fn(); 15 | } 16 | 17 | public method4(this: A): number { 18 | var fn = () => this.a; 19 | return fn(); 20 | } 21 | 22 | static staticMethod(this: A): number { 23 | return this.a; 24 | } 25 | 26 | static typeof(this: A): this { 27 | return typeof this; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/estree/experimental.ts: -------------------------------------------------------------------------------- 1 | import { Node, Expression, MethodDefinition, Property, Class } from './spec'; 2 | 3 | /** 4 | * Decorator 5 | */ 6 | export interface Decorator extends Node { 7 | type: 'Decorator'; 8 | expression: Expression; 9 | } 10 | 11 | /** 12 | * MethodDefinition 13 | */ 14 | export interface ExtendedMethodDefinition extends MethodDefinition { 15 | decorators: Decorator[]; 16 | } 17 | 18 | /** 19 | * Property 20 | */ 21 | export interface ExtendedProperty extends Property { 22 | decorators: Decorator[]; 23 | } 24 | 25 | /** 26 | * Class 27 | */ 28 | export interface ExtendedClass extends Class { 29 | decorators: Decorator[]; 30 | } 31 | -------------------------------------------------------------------------------- /tests/fixtures/semanticInfo/badTSConfig/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": "hello", 3 | "compilerOptions": { 4 | "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ 5 | "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ 6 | "strict": true, /* Enable all strict type-checking options. */ 7 | "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ 8 | } 9 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | TypeScript ESTree 2 | 3 | Originally extracted from: 4 | 5 | TypeScript ESLint Parser 6 | Copyright JS Foundation and other contributors, https://js.foundation 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | 11 | * Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in the 15 | documentation and/or other materials provided with the distribution. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /src/estree/extensions.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Based on https://github.com/estree/estree/blob/master/extensions/type-annotations.md 3 | */ 4 | 5 | import { 6 | Identifier, 7 | Function, 8 | ObjectPattern, 9 | ArrayPattern, 10 | RestElement 11 | } from './spec'; 12 | 13 | /** 14 | * Type Annotations 15 | */ 16 | 17 | /** 18 | * Any type annotation. 19 | */ 20 | export interface TypeAnnotation extends Node {} 21 | 22 | /** 23 | * Identifier 24 | * 25 | * The `typeAnnotation` property is used only in the case of variable declarations with type annotations or function arguments with type annotations. 26 | */ 27 | export interface ExtendedIdentifier extends Identifier { 28 | typeAnnotation: TypeAnnotation | null; 29 | } 30 | 31 | /** 32 | * Functions 33 | * 34 | * The `returnType` property is used to specify the type annotation for the return value of the function. 35 | */ 36 | export interface ExtendedFunction extends Function { 37 | returnType: TypeAnnotation | null; 38 | } 39 | 40 | /** 41 | * Patterns 42 | */ 43 | 44 | /** 45 | * ObjectPattern 46 | */ 47 | export interface ExtendedObjectPattern extends ObjectPattern { 48 | typeAnnotation: TypeAnnotation | null; 49 | } 50 | 51 | /** 52 | * ArrayPattern 53 | */ 54 | export interface ExtendedArrayPattern extends ArrayPattern { 55 | typeAnnotation: TypeAnnotation | null; 56 | } 57 | 58 | /** 59 | * RestElement 60 | */ 61 | export interface ExtendedRestElement extends RestElement { 62 | typeAnnotation: TypeAnnotation | null; 63 | } 64 | -------------------------------------------------------------------------------- /tests/lib/javascript.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @fileoverview Tests for ECMA feature flags 3 | * @author Nicholas C. Zakas 4 | * @author James Henry 5 | * @copyright jQuery Foundation and other contributors, https://jquery.org/ 6 | * MIT License 7 | */ 8 | import path from 'path'; 9 | import shelljs from 'shelljs'; 10 | import { ParserOptions } from '../../src/temp-types-based-on-js-source'; 11 | import { createSnapshotTestBlock } from '../../tools/test-utils'; 12 | 13 | //------------------------------------------------------------------------------ 14 | // Setup 15 | //------------------------------------------------------------------------------ 16 | 17 | const FIXTURES_DIR = './tests/fixtures/javascript'; 18 | 19 | const testFiles = shelljs 20 | .find(FIXTURES_DIR) 21 | .filter(filename => filename.indexOf('.src.js') > -1) 22 | // strip off ".src.js" 23 | .map(filename => 24 | filename.substring(FIXTURES_DIR.length - 1, filename.length - 7) 25 | ); 26 | 27 | //------------------------------------------------------------------------------ 28 | // Tests 29 | //------------------------------------------------------------------------------ 30 | 31 | describe('javascript', () => { 32 | testFiles.forEach(filename => { 33 | const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.js`), 34 | config = { 35 | loc: true, 36 | range: true, 37 | tokens: true, 38 | errorOnUnknownASTType: true 39 | }; 40 | 41 | it( 42 | `fixtures/${filename}.src`, 43 | createSnapshotTestBlock(code, config as ParserOptions) 44 | ); 45 | }); 46 | }); 47 | -------------------------------------------------------------------------------- /tests/lib/typescript.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @fileoverview Tests for TypeScript-specific constructs 3 | * @author Nicholas C. Zakas 4 | * @author James Henry 5 | * @copyright jQuery Foundation and other contributors, https://jquery.org/ 6 | * MIT License 7 | */ 8 | import path from 'path'; 9 | import shelljs from 'shelljs'; 10 | import { ParserOptions } from '../../src/temp-types-based-on-js-source'; 11 | import { createSnapshotTestBlock } from '../../tools/test-utils'; 12 | 13 | //------------------------------------------------------------------------------ 14 | // Setup 15 | //------------------------------------------------------------------------------ 16 | 17 | const FIXTURES_DIR = './tests/fixtures/typescript'; 18 | 19 | const testFiles = shelljs 20 | .find(FIXTURES_DIR) 21 | .filter(filename => filename.indexOf('.src.ts') > -1) 22 | // strip off ".src.ts" 23 | .map(filename => 24 | filename.substring(FIXTURES_DIR.length - 1, filename.length - 7) 25 | ); 26 | 27 | //------------------------------------------------------------------------------ 28 | // Tests 29 | //------------------------------------------------------------------------------ 30 | 31 | describe('typescript', () => { 32 | testFiles.forEach(filename => { 33 | const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.ts`); 34 | const config = { 35 | loc: true, 36 | range: true, 37 | tokens: true, 38 | errorOnUnknownASTType: true 39 | }; 40 | it( 41 | `fixtures/${filename}.src`, 42 | createSnapshotTestBlock(code, config as ParserOptions) 43 | ); 44 | }); 45 | }); 46 | -------------------------------------------------------------------------------- /tests/lib/parse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @fileoverview Tests for tokenize(). 3 | * @author Nicholas C. Zakas 4 | * @author James Henry 5 | * @copyright jQuery Foundation and other contributors, https://jquery.org/ 6 | * MIT License 7 | */ 8 | import * as parser from '../../src/parser'; 9 | import { ParserOptions } from '../../src/temp-types-based-on-js-source'; 10 | import { createSnapshotTestBlock } from '../../tools/test-utils'; 11 | 12 | //------------------------------------------------------------------------------ 13 | // Tests 14 | //------------------------------------------------------------------------------ 15 | 16 | describe('parse()', () => { 17 | describe('basic functionality', () => { 18 | it('should parse an empty string', () => { 19 | expect((parser as any).parse('').body).toEqual([]); 20 | expect(parser.parse('', {} as any).body).toEqual([]); 21 | }); 22 | }); 23 | 24 | describe('modules', () => { 25 | it('should have correct column number when strict mode error occurs', () => { 26 | try { 27 | parser.parse('function fn(a, a) {\n}', { sourceType: 'module' } as any); 28 | } catch (err) { 29 | expect(err.column).toEqual(16); 30 | } 31 | }); 32 | }); 33 | 34 | describe('general', () => { 35 | const code = 'let foo = bar;'; 36 | const config = { 37 | comment: true, 38 | tokens: true, 39 | range: true, 40 | loc: true 41 | }; 42 | 43 | it( 44 | 'output tokens, comments, locs, and ranges when called with those options', 45 | createSnapshotTestBlock(code, config as ParserOptions) 46 | ); 47 | }); 48 | }); 49 | -------------------------------------------------------------------------------- /tests/lib/tsx.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @fileoverview Tests for TSX-specific constructs 3 | * @author James Henry 4 | * @copyright jQuery Foundation and other contributors, https://jquery.org/ 5 | * MIT License 6 | */ 7 | import path from 'path'; 8 | import shelljs from 'shelljs'; 9 | import { ParserOptions } from '../../src/temp-types-based-on-js-source'; 10 | import { createSnapshotTestBlock } from '../../tools/test-utils'; 11 | 12 | //------------------------------------------------------------------------------ 13 | // Setup 14 | //------------------------------------------------------------------------------ 15 | 16 | const TSX_FIXTURES_DIR = './tests/fixtures/tsx'; 17 | 18 | const testFiles = shelljs 19 | .find(TSX_FIXTURES_DIR) 20 | .filter(filename => filename.indexOf('.src.tsx') > -1) 21 | // strip off ".src.tsx" 22 | .map(filename => 23 | filename.substring(TSX_FIXTURES_DIR.length - 1, filename.length - 8) 24 | ); 25 | 26 | //------------------------------------------------------------------------------ 27 | // Tests 28 | //------------------------------------------------------------------------------ 29 | 30 | describe('TSX', () => { 31 | testFiles.forEach(filename => { 32 | const code = shelljs.cat( 33 | `${path.resolve(TSX_FIXTURES_DIR, filename)}.src.tsx` 34 | ); 35 | const config = { 36 | loc: true, 37 | range: true, 38 | tokens: true, 39 | errorOnUnknownASTType: true, 40 | useJSXTextNode: true, 41 | jsx: true 42 | }; 43 | it( 44 | `fixtures/${filename}.src`, 45 | createSnapshotTestBlock(code, config as ParserOptions) 46 | ); 47 | }); 48 | }); 49 | -------------------------------------------------------------------------------- /tests/lib/comments.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @fileoverview Tests for parsing and attaching comments. 3 | * @author Nicholas C. Zakas 4 | * @author James Henry 5 | * @copyright jQuery Foundation and other contributors, https://jquery.org/ 6 | * MIT License 7 | */ 8 | import path from 'path'; 9 | import shelljs from 'shelljs'; 10 | import { ParserOptions } from '../../src/temp-types-based-on-js-source'; 11 | import { createSnapshotTestBlock } from '../../tools/test-utils'; 12 | 13 | //------------------------------------------------------------------------------ 14 | // Setup 15 | //------------------------------------------------------------------------------ 16 | 17 | const FIXTURES_DIR = './tests/fixtures/comments'; 18 | 19 | const testFiles = shelljs 20 | .find(FIXTURES_DIR) 21 | .filter( 22 | filename => 23 | filename.indexOf('.src.js') > -1 || filename.indexOf('.src.ts') > -1 24 | ); 25 | 26 | //------------------------------------------------------------------------------ 27 | // Tests 28 | //------------------------------------------------------------------------------ 29 | 30 | describe('Comments', () => { 31 | testFiles.forEach(filename => { 32 | const code = shelljs.cat(path.resolve(filename)); 33 | const config: ParserOptions = { 34 | loc: true, 35 | range: true, 36 | tokens: true, 37 | comment: true, 38 | jsx: path.extname(filename) === '.js' 39 | }; 40 | // strip off ".src.js" and ".src.ts" 41 | const name = filename.substring( 42 | FIXTURES_DIR.length - 1, 43 | filename.length - 7 44 | ); 45 | it(`fixtures/${name}.src`, createSnapshotTestBlock(code, config)); 46 | }); 47 | }); 48 | -------------------------------------------------------------------------------- /src/ast-converter.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @fileoverview Converts TypeScript AST into ESTree format. 3 | * @author Nicholas C. Zakas 4 | * @author James Henry 5 | * @copyright jQuery Foundation and other contributors, https://jquery.org/ 6 | * MIT License 7 | */ 8 | import convert, { getASTMaps, resetASTMaps, convertError } from './convert'; 9 | import { convertComments } from './convert-comments'; 10 | import { convertTokens } from './node-utils'; 11 | import ts from 'typescript'; 12 | import { Extra } from './temp-types-based-on-js-source'; 13 | 14 | export default ( 15 | ast: ts.SourceFile, 16 | extra: Extra, 17 | shouldProvideParserServices: boolean 18 | ) => { 19 | /** 20 | * The TypeScript compiler produced fundamental parse errors when parsing the 21 | * source. 22 | */ 23 | if ((ast as any).parseDiagnostics.length) { 24 | throw convertError((ast as any).parseDiagnostics[0]); 25 | } 26 | 27 | /** 28 | * Recursively convert the TypeScript AST into an ESTree-compatible AST 29 | */ 30 | const estree: any = convert({ 31 | node: ast, 32 | parent: null, 33 | ast, 34 | additionalOptions: { 35 | errorOnUnknownASTType: extra.errorOnUnknownASTType || false, 36 | useJSXTextNode: extra.useJSXTextNode || false, 37 | shouldProvideParserServices 38 | } 39 | }); 40 | 41 | /** 42 | * Optionally convert and include all tokens in the AST 43 | */ 44 | if (extra.tokens) { 45 | estree.tokens = convertTokens(ast); 46 | } 47 | 48 | /** 49 | * Optionally convert and include all comments in the AST 50 | */ 51 | if (extra.comment) { 52 | estree.comments = convertComments(ast, extra.code); 53 | } 54 | 55 | let astMaps = undefined; 56 | if (shouldProvideParserServices) { 57 | astMaps = getASTMaps(); 58 | resetASTMaps(); 59 | } 60 | 61 | return { estree, astMaps }; 62 | }; 63 | -------------------------------------------------------------------------------- /tests/lib/semantic-diagnostics-enabled.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @fileoverview Tests for optional semantic diagnostics 3 | * @author James Henry 4 | * @copyright jQuery Foundation and other contributors, https://jquery.org/ 5 | * MIT License 6 | */ 7 | import path from 'path'; 8 | import shelljs from 'shelljs'; 9 | import * as parser from '../../src/parser'; 10 | 11 | //------------------------------------------------------------------------------ 12 | // Setup 13 | //------------------------------------------------------------------------------ 14 | 15 | /** 16 | * Process all fixtures, we will only snapshot the ones that have semantic errors 17 | * which are ignored by default parsing logic. 18 | */ 19 | const FIXTURES_DIR = './tests/fixtures/'; 20 | 21 | const testFiles = shelljs 22 | .find(FIXTURES_DIR) 23 | .filter(filename => filename.includes('.src.')) 24 | .map(filename => filename.substring(FIXTURES_DIR.length - 2)); 25 | 26 | //------------------------------------------------------------------------------ 27 | // Tests 28 | //------------------------------------------------------------------------------ 29 | 30 | describe('Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled', () => { 31 | testFiles.forEach(filename => { 32 | const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}`); 33 | const config = { 34 | loc: true, 35 | range: true, 36 | tokens: true, 37 | errorOnUnknownASTType: true, 38 | errorOnTypeScriptSyntacticAndSemanticIssues: true 39 | }; 40 | it(`fixtures/${filename}.src`, () => { 41 | expect.assertions(1); 42 | try { 43 | parser.parseAndGenerateServices(code, config); 44 | expect( 45 | 'TEST OUTPUT: No semantic or syntactic issues found' 46 | ).toMatchSnapshot(); 47 | } catch (err) { 48 | expect(err).toMatchSnapshot(); 49 | } 50 | }); 51 | }); 52 | }); 53 | -------------------------------------------------------------------------------- /tools/test-utils.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @fileoverview Tools for running test cases 3 | * @author Nicholas C. Zakas 4 | * @author James Henry 5 | * @copyright jQuery Foundation and other contributors, https://jquery.org/ 6 | * MIT License 7 | */ 8 | import * as parser from '../src/parser'; 9 | import { ParserOptions } from '../src/temp-types-based-on-js-source'; 10 | 11 | /** 12 | * Returns a raw copy of the given AST 13 | * @param {Object} ast the AST object 14 | * @returns {Object} copy of the AST object 15 | */ 16 | export function getRaw(ast: any) { 17 | return JSON.parse( 18 | JSON.stringify(ast, (key, value) => { 19 | if ((key === 'start' || key === 'end') && typeof value === 'number') { 20 | return undefined; 21 | } 22 | return value; 23 | }) 24 | ); 25 | } 26 | 27 | export function parseCodeAndGenerateServices( 28 | code: string, 29 | config: ParserOptions 30 | ) { 31 | return parser.parseAndGenerateServices(code, config); 32 | } 33 | 34 | /** 35 | * Returns a function which can be used as the callback of a Jest test() block, 36 | * and which performs an assertion on the snapshot for the given code and config. 37 | * @param {string} code The source code to parse 38 | * @param {ParserOptions} config the parser configuration 39 | * @returns {jest.ProvidesCallback} callback for Jest it() block 40 | */ 41 | export function createSnapshotTestBlock( 42 | code: string, 43 | config: ParserOptions, 44 | generateServices?: true 45 | ) { 46 | /** 47 | * @returns {Object} the AST object 48 | */ 49 | function parse() { 50 | const ast = generateServices 51 | ? parser.parseAndGenerateServices(code, config).ast 52 | : parser.parse(code, config); 53 | return getRaw(ast); 54 | } 55 | 56 | return () => { 57 | try { 58 | const result = parse(); 59 | expect(result).toMatchSnapshot(); 60 | } catch (e) { 61 | /** 62 | * If we are deliberately throwing because of encountering an unknown 63 | * AST_NODE_TYPE, we rethrow to cause the test to fail 64 | */ 65 | if (e.message.match('Unknown AST_NODE_TYPE')) { 66 | throw new Error(e); 67 | } 68 | expect(parse).toThrowErrorMatchingSnapshot(); 69 | } 70 | }; 71 | } 72 | -------------------------------------------------------------------------------- /tests/lib/jsx.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @fileoverview Tests for JSX 3 | * @author Nicholas C. Zakas 4 | * @author James Henry 5 | * @copyright jQuery Foundation and other contributors, https://jquery.org/ 6 | * MIT License 7 | */ 8 | import path from 'path'; 9 | import shelljs from 'shelljs'; 10 | import { ParserOptions } from '../../src/temp-types-based-on-js-source'; 11 | import { createSnapshotTestBlock } from '../../tools/test-utils'; 12 | import filesWithKnownIssues from '../jsx-known-issues'; 13 | 14 | //------------------------------------------------------------------------------ 15 | // Setup 16 | //------------------------------------------------------------------------------ 17 | 18 | const JSX_FIXTURES_DIR = './tests/fixtures/jsx'; 19 | 20 | const jsxTestFiles = shelljs 21 | .find(JSX_FIXTURES_DIR) 22 | .filter(filename => filename.indexOf('.src.js') > -1) 23 | .filter(filename => 24 | filesWithKnownIssues.every(fileName => filename.indexOf(fileName) === -1) 25 | ) 26 | // strip off ".src.js" 27 | .map(filename => 28 | filename.substring(JSX_FIXTURES_DIR.length - 1, filename.length - 7) 29 | ); 30 | 31 | const JSX_JSXTEXT_FIXTURES_DIR = './tests/fixtures/jsx-useJSXTextNode'; 32 | 33 | const jsxTextTestFiles = shelljs 34 | .find(JSX_JSXTEXT_FIXTURES_DIR) 35 | .filter(filename => filename.indexOf('.src.js') > -1) 36 | // strip off ".src.js" 37 | .map(filename => 38 | filename.substring(JSX_JSXTEXT_FIXTURES_DIR.length - 1, filename.length - 7) 39 | ); 40 | 41 | //------------------------------------------------------------------------------ 42 | // Tests 43 | //------------------------------------------------------------------------------ 44 | 45 | describe('JSX', () => { 46 | /** 47 | * Test each fixture file 48 | */ 49 | function testFixture( 50 | fixturesDir: string, 51 | useJSXTextNode: boolean 52 | ): (filename: string) => void { 53 | return filename => { 54 | const code = shelljs.cat(`${path.resolve(fixturesDir, filename)}.src.js`); 55 | 56 | const config = { 57 | loc: true, 58 | range: true, 59 | tokens: true, 60 | errorOnUnknownASTType: true, 61 | useJSXTextNode, 62 | jsx: true 63 | }; 64 | 65 | it( 66 | `fixtures/${filename}.src`, 67 | createSnapshotTestBlock(code, config as ParserOptions) 68 | ); 69 | }; 70 | } 71 | 72 | describe('useJSXTextNode: false', () => { 73 | jsxTestFiles.forEach(testFixture(JSX_FIXTURES_DIR, false)); 74 | }); 75 | describe('useJSXTextNode: true', () => { 76 | jsxTextTestFiles.forEach(testFixture(JSX_JSXTEXT_FIXTURES_DIR, true)); 77 | }); 78 | }); 79 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "typescript-estree", 3 | "description": "A parser that converts TypeScript source code into an ESTree compatible form", 4 | "homepage": "https://github.com/JamesHenry/typescript-estree", 5 | "main": "dist/parser.js", 6 | "version": "0.0.0-development", 7 | "files": [ 8 | "dist", 9 | "README.md", 10 | "LICENSE" 11 | ], 12 | "engines": { 13 | "node": ">=6.14.0" 14 | }, 15 | "repository": "JamesHenry/typescript-estree", 16 | "bugs": { 17 | "url": "https://github.com/JamesHenry/typescript-estree/issues" 18 | }, 19 | "license": "BSD-2-Clause", 20 | "devDependencies": { 21 | "@babel/code-frame": "7.0.0", 22 | "@babel/parser": "7.2.3", 23 | "@commitlint/cli": "^7.1.2", 24 | "@commitlint/config-conventional": "^7.1.2", 25 | "@commitlint/travis-cli": "^7.1.2", 26 | "@types/babel-code-frame": "^6.20.1", 27 | "@types/jest": "^23.3.9", 28 | "@types/lodash.isplainobject": "^4.0.4", 29 | "@types/lodash.unescape": "^4.0.4", 30 | "@types/node": "^10.12.2", 31 | "@types/semver": "^5.5.0", 32 | "@types/shelljs": "^0.8.0", 33 | "cz-conventional-changelog": "2.1.0", 34 | "glob": "7.1.2", 35 | "husky": "0.14.3", 36 | "jest": "23.6.0", 37 | "lint-staged": "7.3.0", 38 | "lodash.isplainobject": "4.0.6", 39 | "prettier": "^1.14.3", 40 | "semantic-release": "^15.9.16", 41 | "shelljs": "0.8.2", 42 | "travis-deploy-once": "^5.0.8", 43 | "ts-jest": "^23.10.4", 44 | "typescript": "~3.2.1" 45 | }, 46 | "keywords": [ 47 | "ast", 48 | "estree", 49 | "ecmascript", 50 | "javascript", 51 | "typescript", 52 | "parser", 53 | "syntax" 54 | ], 55 | "scripts": { 56 | "build": "tsc", 57 | "test": "jest --coverage", 58 | "unit-tests": "jest \"./tests/lib/.*\"", 59 | "ast-alignment-tests": "jest spec.ts", 60 | "precommit": "npm test && lint-staged", 61 | "cz": "git-cz", 62 | "commitmsg": "commitlint -E GIT_PARAMS", 63 | "check-format": "prettier --list-different \"./**/*.{ts,js,json,md}\"", 64 | "semantic-release": "semantic-release", 65 | "travis-deploy-once": "travis-deploy-once" 66 | }, 67 | "dependencies": { 68 | "lodash.unescape": "4.0.1", 69 | "semver": "5.5.0" 70 | }, 71 | "peerDependencies": { 72 | "typescript": "*" 73 | }, 74 | "lint-staged": { 75 | "*.{ts,js,json,md}": [ 76 | "prettier --write", 77 | "git add" 78 | ] 79 | }, 80 | "config": { 81 | "commitizen": { 82 | "path": "./node_modules/cz-conventional-changelog" 83 | } 84 | }, 85 | "commitlint": { 86 | "extends": [ 87 | "@commitlint/config-conventional" 88 | ] 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /tests/ast-alignment/spec.ts: -------------------------------------------------------------------------------- 1 | import fs from 'fs'; 2 | import { fixturesToTest } from './fixtures-to-test'; 3 | import { parse } from './parse'; 4 | import * as parseUtils from './utils'; 5 | 6 | fixturesToTest.forEach(fixture => { 7 | const filename = fixture.filename; 8 | const source = fs.readFileSync(filename, 'utf8').replace(/\r\n/g, '\n'); 9 | 10 | /** 11 | * Parse with typescript-estree 12 | */ 13 | const typeScriptESTreeResult = parse(source, { 14 | parser: 'typescript-estree', 15 | jsx: fixture.jsx 16 | }); 17 | 18 | /** 19 | * Parse the source with @babel/parser typescript-plugin 20 | */ 21 | const babelParserResult = parse(source, { 22 | parser: '@babel/parser', 23 | jsx: fixture.jsx 24 | }); 25 | 26 | /** 27 | * If babel fails to parse the source, ensure that typescript-estree has the same fundamental issue 28 | */ 29 | if (babelParserResult.parseError) { 30 | /** 31 | * FAIL: babel errored but typescript-estree did not 32 | */ 33 | if (!typeScriptESTreeResult.parseError) { 34 | it(`TEST FAIL [BABEL ERRORED, BUT TS-ESTREE DID NOT] - ${filename}`, () => { 35 | expect(typeScriptESTreeResult.parseError).toEqual( 36 | babelParserResult.parseError 37 | ); 38 | }); 39 | return; 40 | } 41 | /** 42 | * Both parsers errored - this is OK as long as the errors are of the same "type" 43 | * E.g. Both must be a SyntaxError, or both must be a RangeError etc. 44 | */ 45 | it(`[Both parsers error as expected] - ${filename}`, () => { 46 | expect(babelParserResult.parseError.name).toEqual( 47 | typeScriptESTreeResult.parseError.name 48 | ); 49 | }); 50 | return; 51 | } 52 | 53 | /** 54 | * FAIL: typescript-estree errored but babel did not 55 | */ 56 | if (typeScriptESTreeResult.parseError) { 57 | it(`TEST FAIL [TS-ESTREE ERRORED, BUT BABEL DID NOT] - ${filename}`, () => { 58 | expect(babelParserResult.parseError).toEqual( 59 | typeScriptESTreeResult.parseError 60 | ); 61 | }); 62 | return; 63 | } 64 | 65 | /** 66 | * No errors, assert the two ASTs match 67 | */ 68 | it(`${filename}`, () => { 69 | expect(babelParserResult.ast).toBeTruthy(); 70 | expect(typeScriptESTreeResult.ast).toBeTruthy(); 71 | /** 72 | * Perform some extra formatting steps on the babel AST before comparing 73 | */ 74 | expect( 75 | parseUtils.removeLocationDataAndSourceTypeFromProgramNode( 76 | parseUtils.preprocessBabylonAST(babelParserResult.ast), 77 | fixture.ignoreSourceType 78 | ) 79 | ).toEqual( 80 | parseUtils.removeLocationDataAndSourceTypeFromProgramNode( 81 | typeScriptESTreeResult.ast, 82 | fixture.ignoreSourceType 83 | ) 84 | ); 85 | }); 86 | }); 87 | --------------------------------------------------------------------------------